Error 1045 (28000): Access denied for user ' root ' @ ' localhost ' (using password:no) on Red Hat Enterprise Linux 5 server MySQL boot error : ERROR 1045 (28000): Access denied for user ' root ' @ ' localhost ' (using Password:no)
Cause 1-Startup command error:
I started by typing the command directly: MySQL start
The correct startup command is:/etc/rc.d/init.d/mysql start
Cause 2-Configuration file Error:
Check etc below the MY.CNF below: [Client]
#password = Your_password
Port = 3306
# here follows entries for some specific programs
# The MySQL server
Port = 3306
Cause 3-Startup file error:
Need to modify MySQL startup script/etc/rc.d/init.d/mysql,
where datadir=? Check the line!
Cause 4-If you have an error when using PHP connection!
In/etc/php.ini, modify the value of the Mysql.default_socket setting to:
Back to finish setting up a connection: Ln-s/var/lib/mysql/mysql.sock/tmp/mysql.sock
(in/etc/php.ini mysql.default_socket this file, the description of the value of Mysql.default_socket is this,
;D efault socket name for local MySQL connects. If empty, uses the built-in MySQL defaults.
This value is empty at first, that is, if we do not take the initiative to modify it, PHP will use the built-in MySQL default value) Another article: MySQL ERROR 1045 (28000): Access denied for user ' root ' localhost ' problem solving
This problem requires a forced re-modification of the password, as follows:
/etc/init.d/mysql Stop (service mysqld stop)
Also open an SSH connection
[[email protected] ~]# MySQL
Mysql>update User Set Password=password ("123456") where user= "root";
Pkill-kill-t pts/0 can force a 0 * * User (previously run Mysqld_safe User window) to kick out
Normal start Mysql:/etc/init.d/mysql start (Service mysqld start)
Note: You also encounter the need to service MySQL star in order to start service MySQL stop to stop.
There is also the direct use of MySQL can not find the command, the error is "Bash:mysql:command not found" can be directly **mysql the Bin folder in the installation directory with the absolute path to run commands, and some need to add./mysql to execute. This article from:http://sundful.javaeye.com/blog/704337 another article about clearing passwords, resetting users: quote:
| First things first. Log in as root and stop the MySQL daemon. ,
Now lets start up the MYSQ L Daemon and skip the grant tables which store the passwords.
(Press CTRL + C now to disown the process and start typing commands Again)
should see mysqld start up successfully. If not, well you have bigger issues. Now you should is able to connect to MySQL without a password.
sudo mysql--user=root mysql
Update user set Password=password (' New-password ');
now kill your running mysqld then restart it normally.
sudo killall mysqld_safe&
(Press CTRL + C now-disown the process and start typing commands again)
You should Be good to go. Try not to forget your password again.
Http://www.howtoforge.com/reset-forgotten-mysql-root-password Another summary of denied: MySQL authentication denial3/29/2005, 12:05 am
It seems to me, a lot of people has auth denial when trying to make connections to MySQL. They seem to ignore the text of the error message. ' Access Denied ' means access Denied, nothing else.
Remember three things has to match. The host as MySQL sees it, the username, and the password. When MySQL returns access denied it's not broken. One or more of the those three things does not match. I don ' t really need to reiterate what's in the manual. Chang the lock or change the key to make it fit.
The contents of the document connected to MySQL are: http://dev.mysql.com/doc/refman/5.5/en/access-denied.html to: http://www.cnblogs.com/khler/ Archive/2011/02/10/1950819.html
Go-fix MySQL ERROR 1045 (28000): Access denied for user ' root ' @ ' localhost ' problem