如果mysql正在运行,/etc/init.d/mysqld stop
启动mysql(无需输入密码):bin/safe_mysqld –skip-grant-tables &
在bin目录下执行mysql,此时无需输入密码即可进入
# /usr/bin/mysql
>use mysql
>update user set password=password(”new_pass”) where user=”root”;
>flush privileges;
重新运行mysql: /etc/init.d/mysqld restart