问题:mysql
MySQL安装后root用户没法链接,提示 ERROR 1045 (28000): Access denied for user ’root’@’localhost’ (using password: NO)sql
解决:数据库
# /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>服务器
问题:ui
操做MySQL数据库时,提示 You must SET PASSWORD before executing this statementthis
解决:spa
mysql> SET PASSWORD = PASSWORD('123456');rest
问题:ip
CentOS系统安装好MySQL后,默认状况下不支持用户经过非本机链接上数据库服务器。it
解决:
在mysql控制台执行
mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'MyPassword' WITH GRANT OPTION;mysql> FLUSH PRIVILEGES;