Original http://blog.csdn.net/firefoxbug/article/details/7931730 installation Mysql[[email protected] ~]# yum-y install mysql-server← Installation Mysql[[email protected] ~]# yum-y install php-mysql← installation php-mysql configuration Mysql[[email protected] ~]#/etc/init.d/mysqld Stop stop MySQL service [[email protected] ~]# vim/etc/my.cnf mysql service configuration file
[Mysqld]
Datadir=/var/lib/mysql
Socket=/var/lib/mysql/mysql.sock
User=mysql
# Disabling Symbolic-links is recommended to prevent assorted security risks
Skip-grant-tables #添加这句话, you don't need a password when you log in to MySQL.
Symbolic-links=0
[[email protected] ~]#/etc/init.d/mysqld start MySQL service
[[email protected] ~]# mysql log in to MySQL
mysql> use MySQL;
mysql> UPDATE user SET Password = Password (' New-password ') WHERE user = ' root ';
mysql> flush Privileges;
Mysql> quit
The/ETC/MY.CNF is Skip-grant-tables annotated and the configuration file is restored as is.
[[email protected] ~]#/etc/init.d/mysqld restart start MySQL service
[[email protected] ~]# mysql-u root-p Enter password
Change Password
Original account: root, Password: root, change to fire
[Email protected] ~]# mysqladmin-u root-p password fire
Enter Password:
MySQL Password initialization