VnLamp

Go Back   VnLamp > Khu vực Training > LPI > Mail

Trả lời
 
LinkBack Ðiều Chỉnh Xếp Bài
Không đổi password root cua MySQL được
Old
  (#1 (permalink))
 
Status: Offline
Posts: 6
Tham gia: Feb 2010
Junior Member
Default Không đổi password root cua MySQL được - 13-08-2010, 15:13 13-08-2010

Nhờ các ACE trên diễn đàn giúp, Hiện tại mình theo hướng dẫn theo link này để change passs nhưng vẫn không được, mong các ACE coi giúp coi có cách nào khác không ? Cám ơn rất nhiều.

Reset Forgotten MySQL Root Password | HowtoForge - Linux Howtos and Tutorials
   
Trả Lời Với Trích Dẫn
Old
  (#2 (permalink))
 
Status: Offline
Posts: 222
Tham gia: Jan 2008
Senior Member
 
mice's Avatar
Default 13-08-2010, 17:13 13-08-2010

Step # 1: Stop the MySQL server process.

Step # 2: Start the MySQL (mysqld) server/daemon process with the --skip-grant-tables option so that it will not prompt for password.

Step # 3: Connect to mysql server as the root user.

Step # 4: Setup new mysql root account password i.e. reset mysql password.

Step # 5: Exit and restart the MySQL server.

Here are commands you need to type for each step (login as the root user):
Step # 1 : Stop mysql service

# /etc/init.d/mysql stop
Output:

Stopping MySQL database server: mysqld.

Step # 2: Start to MySQL server w/o password:

# mysqld_safe --skip-grant-tables &
Output:

[1] 5988
Starting mysqld daemon with databases from /var/lib/mysql
mysqld_safe[6025]: started

Step # 3: Connect to mysql server using mysql client:

# mysql -u root
Output:

Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1 to server version: 4.1.15-Debian_1-log

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql>

Step # 4: Setup new MySQL root user password

mysql> use mysql;
mysql> update user set password=PASSWORD("NEW-ROOT-PASSWORD") where User='root';
mysql> flush privileges;
mysql> quit
Step # 5: Stop MySQL Server:

# /etc/init.d/mysql stop
Output:

Stopping MySQL database server: mysqld
STOPPING server from pid file /var/run/mysqld/mysqld.pid
mysqld_safe[6186]: ended

[1]+ Done mysqld_safe --skip-grant-tables

Step # 6: Start MySQL server and test it

# /etc/init.d/mysql start
# mysql -u root -p


mice2503

thay đổi nội dung bởi: mice, 13-08-2010 lúc 20:13 13-08-2010.
  Send a message via Yahoo to mice Send a message via Skype™ to mice 
Trả Lời Với Trích Dẫn
Old
  (#3 (permalink))
 
Status: Offline
Posts: 6
Tham gia: Feb 2010
Junior Member
Default 16-08-2010, 09:16 16-08-2010

mysql -u root
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.0.77 Source distribution

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> use mysql;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
mysql> update user set password=PASSWORD("xxxx") where User='root';
Query OK, 0 rows affected (0.00 sec)
Rows matched: 0 Changed: 0 Warnings: 0

Mình làm theo hướng dẫn nhưng vẫn chưa đổi được, sao vẫn báo la CHANGED: 0 vậy ? Các bạn xem dùm coi có gì sai không ?
Cám ơn trước.
   
Trả Lời Với Trích Dẫn
Old
  (#4 (permalink))
 
Status: Offline
Posts: 208
Tham gia: Oct 2008
BQT VNLAMP
 
hellonewday's Avatar
Default 16-08-2010, 10:16 16-08-2010

Restart lai mysql xem sao?
   
Trả Lời Với Trích Dẫn
Old
  (#5 (permalink))
 
Status: Offline
Posts: 222
Tham gia: Jan 2008
Senior Member
 
mice's Avatar
Default 16-08-2010, 11:16 16-08-2010

chắc chắn làm thiếu 1 bước gì rồi, check kỹ nha, cái này đã tested


mice2503
  Send a message via Yahoo to mice Send a message via Skype™ to mice 
Trả Lời Với Trích Dẫn
Old
  (#6 (permalink))
 
Status: Offline
Posts: 511
Tham gia: Dec 2007
BQT VNLAMP
 
goldenbook's Avatar
Default 16-08-2010, 11:16 16-08-2010

hi Trí,
em xem kỹ lại quá trình mình làm, anh vừa test lại step by step giúp em.
Trích:
[root@OSS2 ~]# /etc/init.d/mysqld stop
Stopping MySQL: [ OK ]
[root@OSS2 ~]# mysqld_safe --skip-grant-tables --skip-networking &
[1] 3046
[root@OSS2 ~]# Starting mysqld daemon with databases from /var/lib/mysql

[root@OSS2 ~]# mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.0.77 Source distribution

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> use mysql;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
mysql> UPDATE user set password=PASSWORD('111111') where user='root';
Query OK, 3 rows affected (0.00 sec)
Rows matched: 3 Changed: 3 Warnings: 0

mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)

mysql> exit
Bye
[root@OSS2 ~]# /etc/init.d/mysqld restart
STOPPING server from pid file /var/run/mysqld/mysqld.pid
100706 08:57:57 mysqld ended

Stopping MySQL: [ OK ]
Starting MySQL: [ OK ]
[1]+ Done mysqld_safe --skip-grant-tables --skip-networking
[root@OSS2 ~]# mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.0.77 Source distribution

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql>


Success inlife isn't a given. It's costs attitude, ambition and acceptance.
   
Trả Lời Với Trích Dẫn
Old
  (#7 (permalink))
 
Status: Offline
Posts: 53
Tham gia: Nov 2009
BQT VNLAMP
 
kingcasino's Avatar
Default 16-08-2010, 11:16 16-08-2010

Các bước a MICE và a GOLDENBOOK hướng dẫn ở trên OK áh bạn, hôm trước mình cũng bị vậy và đã changed được pass root theo các bước trên...

Bạn thử làm lại tuần tự các bước xem sao :d
   
Trả Lời Với Trích Dẫn
Trả lời


Ðiều Chỉnh
Xếp Bài

Quyền Sử Dụng Ở Diễn Ðàn
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is Mở
Smilies đang Mở
[IMG] đang Mở
HTML đang Tắt
Trackbacks are Mở
Pingbacks are Mở
Refbacks are Mở


Múi giờ GMT. Hiện tại là 00:23 23-05-2012.