默认情况下安装完成后mysql没设root密码,可以直接登录: [[email protected] ~]# mysql -uroot Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 9 Server version: 5.1.49 MySQL Community Server (GPL) Copyright (c) 2000, 2010, Oracle and/or it
1.重置root密码: service mysql stop# mysqld_safe --user=mysql --skip-grant-tables --skip-networking &# mysql -u root mysqlmysql> UPDATE user SET Password=PASSWORD('newpassword') where USER='root';mysql> FLUSH PRIVILEGES;mysql> quit # /etc/init.d/m