This machine is a CentOS 6.5 installed version of MySQL that is 5.1.
After installing MySQL, the first time to start the MySQL service, the need/TMP has 777 (RWXRWXRWX) permissions, but the landlord's/tmp is 755 (rwxr-xr-x), [In fact, the default is 777, I mistakenly deleted the TMP before, and then built the TMP , and the authority did not follow the change, small white sadness, said more are tears = =] so if you do not know the pit, the first time basically will be wrong. This time to modify/tmp is too late, so we can only reinstall MySQL
Error 1045 (28000): Access denied for user [email protected] (using Password:no)
PS: It seems that the first time something is very important ah, MySQL is no exception (cover your Face to escape.) )
Most of the methods found on the Internet are:
#/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>
However, after this test, it is still error 1045 (28000): Access denied for user [email protected] (using Password:no).
Solution: Remove MySQL completely, reinstall MySQL
The process is as follows:
1. Ensure that MySQL is stopped first
[[Email protected] ~]# service mysqld stop
Stop mysqld: [OK]
2. Query the MySQL related package and delete all
[[email protected] ~]# rpm-qa |grep-i MySQL
mysql-server-5.1.73-7.el6.i686
mysql-5.1.73-7.el6.i686
perl-dbd-mysql-4.013-3.el6.i686
mysql-libs-5.1.73-7.el6.i686
[Email protected] ~]# Rpm-ev mysql-server-5.1.73-7.el6.i686
Warning:/var/log/mysqld.log saved As/var/log/mysqld.log.rpmsave
[Email protected] ~]# rpm-e--nodeps mysql-5.1.73-7.el6.i686
[Email protected] ~]# rpm-e--nodeps mysql-libs-5.1.73-7.el6.i686
[Email protected] ~]# rpm-e--nodeps perl-dbd-mysql-4.013-3.el6.i686
[Email protected] ~]# Rpm-qa | Grep-i MySQL
mysql-libs-5.1.73-7.el6.i686
[Email protected] ~]# rpm-e--nodeps mysql-libs-5.1.73-7.el6.i686
[[email protected] ~]# Find/-name MySQL
/var/lib/mysql
/var/lib/mysql/mysql
[Email protected] ~]# Rm-rf/var/lib/mysql
[Email protected] ~]# Rm-rf/var/lib/mysql/mysql
3. Manually delete the configuration file (not deleted by default)
[Email protected] ~]# RM-RF/ETC/MY.CNF
4, confirm the deletion is thorough, the query does not have any result that has been completely deleted
[Email protected] ~]# Rpm-aq | Grep-i MySQL
5, modify the permissions of/tmp, reinstall MySQL, after startup, MySQL will be able to run normally.
Installation of MySQL error 1045 (28000) due to insufficient/TMP permissions: Access denied for user [email protected] (using Password:no) solution