ERROR 1045 (28000): Access denied for user ' root ' @ ' localhost ' (using Password:no)

Source: Internet
Author: User

ERROR 1045 (28000): Access denied for user ' root ' @ ' localhost ' (using Password:no)MySQL boot error on Red Hat Enterprise Linux 5 server: 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
Socket =/usr/mysql-data/mysql.sock
# here follows entries for some specific programs
# The MySQL server
[Mysqld]
Port = 3306
Socket =/usr/mysql-data/mysql.sock

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:
Mysql.default_socket=/var/lib/mysql/mysql.sock
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 ' localhostSolution to the problem

This problem requires a forced re -modification of the password, as follows:

/etc/init.d/mysql Stop (service mysqld stop)
/usr/bin/mysqld_safe--skip-grant-tables
Also open an SSH connection
[[email protected] ~]# MySQL
Mysql>use MySQL
Mysql>update User Set Password=password ("123456") where user= "root";
Mysql>flush privileges;
Mysql>exit

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 comes from: http://sundful.javaeye.com/blog/704337Another article about clearing passwords and resetting users: Quote:
First things first. Log in as root and stop the MySQL daemon.

Sudo/etc/init.d/mysql Stop


Now lets start up the MySQL daemon and skip the grant tables which store the passwords.

sudo mysqld_safe--skip-grant-tables&

(Press CTRL + C now to disown the process and start typing commands again)

You 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 ');
Flush privileges;
Exit;


Now kill your running mysqld then restart it normally.

sudo killall mysqld_safe&
(Press CTRL + C now to disown the process and start typing commands again)
/etc/init.d/mysql Start

You should is 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 original link: http://www.cnblogs.com/khler/ Archive/2011/02/10/1950819.html

ERROR 1045 (28000): Access denied for user ' root ' @ ' localhost ' (using Password:no)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.