Install mysql [root @ sample ~] # Yum-y install mysql-server Plugin install MySQL [root @ sample ~] # Yum-y install php-mysql plugin install php-mysql configure mysql [root @ sample ~] #/Etc/init. d/mysqld stop mysql service [root @ sample ~] # Vim/etc/my. cnf mysql service configuration file [mysqld] www.2cto.com datadir =/var/lib/mysqlsocket =/var/lib/mysql. sockuser = mysql # Disabling symbolic-links is recommended to prevent assorted security risksskip-grant-tables # Add this sentence, at this time, you do not need to log on to mysql with the password symbolic-links = 0 [root @ sample ~]. #/Etc/init. d/mysqld start mysql service [root @ sample ~] # Mysql login mysqlmysql> USE mysql; mysql> UPDATE user SET Password = password ('new-password') WHERE User = 'root'; mysql> flush privileges; mysql> quit puts/etc/my. in cnf, skip-grant-tables is commented out, and the configuration file is restored as is. Www.2cto.com [root @ sample ~] #/Etc/init. d/mysqld restart start mysql service [root @ sample ~] # Mysql-u root-p Enter Password Change Password original account: root, password: root, change to fire [root @ sample ~] # Mysqladmin-u root-p password fire Enter password: