# /etc/init.d/mysql stop 或者 service mysqld stop
# mysqld_safe --user=mysql --skip-grant-tables --skip-networking &
# mysql -u root mysql
mysql> UPDATE user SET Password=PASSWORD(‘newpassword‘) where USER=‘root‘;
mysql> FLUSH PRIVILEGES;
mysql> quit
# /etc/init.d/mysql restart 或者 service mysqld start
# mysql -uroot -p
Enter password:
支持远程访问:http://blog.csdn.net/sun614345456/article/details/53672150
mysql -uroot -p
use mysql;
GRANT ALL PRIVILEGES ON *.* TO ‘root‘@‘%‘ IDENTIFIED BY ‘password‘ WITH GRANT OPTION;
FLUSH PRIVILEGES;
service mysqld restart
原文:http://www.cnblogs.com/fhtwins/p/7470782.html