Problem:
[Email protected] mysql]# mysql-u root-p
Enter Password:
ERROR 1045 (28000): Access denied for user ' root ' @ ' localhost ' (using Password:no)
Workaround:
Method One:
#/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: < Enter the newly set password newpassword>
Mysql>
Method Two:
Use the user name and password provided directly in the [client] section of the/etc/mysql/debian.cnf file:
# mysql-udebian-sys-maint-p
Enter Password: < Enter the password for the [client] section >
mysql> UPDATE user SET Password=password (' NewPassword ') where user= ' root ';
mysql> FLUSH privileges;
Mysql> quit
# mysql-uroot-p
Enter Password: < Enter the newly set password newpassword>
Mysql>
After the above method executes, login MySQL also need to set the password, otherwise you can not do other operations, prompted to set the password
Set Password=password (' Weixiao ');
MySQL installed after the directory under Linux
1. Database Directory
/var/lib/mysql/
2. Configuration files
/usr/share/mysql (mysql.server command and configuration file)
3. Related commands
/usr/bin (Mysqladmin mysqldump and other commands)
4. Startup script
/etc/init.d/mysql start|stop|restart|status (startup script file mysql directory)
After Linux has installed the service, open port command:
/sbin/iptables-i input-p TCP--dport 9090-j ACCEPT; (Case sensitive)
Then enter the following command to view the port:
/etc/init.d/iptables status
Finally, you need to save and restart the firewall
/etc/rc.d/init.d/iptables Save (Save)
Service iptables Restart (restart)
Everything OK, can be accessed remotely
********************************************************
This error is reported when using the MySQL tool for remote access:
Host is not allowed to connect to this MySQL server
This is because there is no authorization if you want to connect to the MySQL server from any host.
Grant all privileges on * * to ' root ' @ '% ' identified by ' Weixiao ' with GRANT option;
If you want to allow only users to connect to the MySQL server from a fixed IP host.
Grant all privileges on * * to ' root ' @ ' 170.12.12.155 ' identified by ' Weixiao ' with GRANT option;
Linux install MySQL default root cannot log on the problem