问题:
MySQL安装后root用户无法连接,提示 ERROR 1045 (28000): Access denied for user ’root’@’localhost’ (using password: NO)
解决:
# /etc/init.d/mysql 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
# mysql -uroot -p
Enter password: <输入新设的密码newpassword>
问题:
操作MySQL数据库时,提示 You must SET PASSWORD before executing this statement
解决:
mysql> SET PASSWORD = PASSWORD('123456');
问题:
CentOS系统安装好MySQL后,默认情况下不支持用户通过非本机连接上数据库服务器。
解决:
在mysql控制台执行
mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'MyPassword' WITH GRANT OPTION;
mysql> FLUSH PRIVILEGES;