Can't connect to mysql on OS X - mysql

I have installed mysql with Homebrew and I just can't access it.
When I run mysql -uroot, it says, I can't access. So I though maybe there was a password set. So I deleted /usr/local/var/mysql and ran mysqld --initialize. This output, besides other things:
A temporary password is generated for root#localhost: randomPassword
So I tried mysql -uroot -p'randomPassword'. But this still doesn't work. What is my password? I may have installedmysql` with Homebrew before that, but I can't imagine that the old password is still saved somewhere.

I don't have experience of MacOS installs. In my experience of Linux installs, it prompts for the user to enter a root password on install.
There are however a wealth of instructions around on how to reset the root password if not known. I have used the --skip-grant-tables method many times.
Stop the MySQL server
Restart it with --skip-grant-tables
Open up the mysql command line client
mysql> FLUSH PRIVILEGES;
mysql> ALTER USER 'root'#'localhost' IDENTIFIED BY 'MyNewPass'; for MySQL 5.7.6 and later, or
mysql> SET PASSWORD FOR 'root'#'localhost' = PASSWORD('MyNewPass'); for MySQL 5.7.5 and earlier
Source:
MySQL Manual

Related

ERROR 1045 (28000): Access denied for user 'root'#'localhost'

so i installed the MySQL application for the first time. firstly i saw the command line client is not opening so i searched for solutions. they said i must go to the bin directory and run it manually. and after i run the cmd mysql -uroot -p and run it and enter password, it gives me the error: ERROR 1045 (28000): Access denied for user 'root'#'localhost' i tried every single solution on stackoverflow including disabling permissions, running manually which i mentioned above, starting the service from service.msc, running it with password and without.... it just doesnt want to work.
appreciate any help in advance.
GENERIC MYSQL INFO
To start with, read the mysql manual: https://dev.mysql.com/doc/refman/5.7/en/resetting-permissions.html
The steps will show you how to shut down the service and start it with an overriding command that doesn't require passwords, then you reset the password. From the manual:
Stop the MySQL server, then restart it with the --skip-grant-tables option. This enables anyone to connect without a password and with all privileges and disables account-management statements such as ALTER USER and SET PASSWORD. Because this is insecure, you might want to use --skip-grant-tables in conjunction with --skip-networking to prevent remote clients from connecting.
Connect to the MySQL server using the mysql client; no password is necessary because the server was started with --skip-grant-tables:
shell> mysql
In the mysql client, tell the server to reload the grant tables so that account-management statements work:
mysql> FLUSH PRIVILEGES;
Then change the 'root'#'localhost' account password. Replace the password with the password that you want to use. To change the password for a root account with a different hostname part, modify the instructions to use that hostname.
MySQL 5.7.6 and later:
mysql> ALTER USER 'root'#'localhost' IDENTIFIED BY 'MyNewPass';
MySQL 5.7.5 and earlier:
mysql> SET PASSWORD FOR 'root'#'localhost' = PASSWORD('MyNewPass');
Or directly on the user table:
UPDATE mysql.user SET password=PASSWORD('mynewpassword') WHERE user='root';
XAMPP SPECIFIC
Stop the MySQL service. Open a command window. Change to the XAMPP MySQL directory:
> cd \xampp\mysql\bin\
Run the service without security (note you are running mysqld, not mysql):
> mysqld.exe --skip-grant-tables
The MySQL service will be running in this window, so open another command window and switch to the XAMPP MySQL directory:
> cd \xampp\mysql\bin\
Run the MySQL client:
> mysql
Update the password:
mysql> UPDATE mysql.user SET password=PASSWORD('mynewpassword') WHERE user='root';
Exit MySQL:
mysql> \q
Use task manager to cancel the mysqld.exe that is still running. Restart the mysql service.
I got the answer myself. Seemingly, if you get this error, it means that you need to reset your password. You can learn how to do that in MySQL from this link.
And don't forget to change the 5.7 version with your currently installed version in using commands (mine was 8.0).
After that, everything was working fine for me.

mysqli_real_connect(): (HY000/1045): Access denied for user 'phpmyadmin'#'localhost' (using password: YES)

I am doing an online course from coursera where they tolm me to install phpmyadmin.
NOW I am a total beginner in this thing so I am not able to do much research upon that and now somehow, after I installed MySQL and phpmyadmin, in the localhost, I am getting some errors, is that common? Because the other participants in the course are not getting them. If that's fatal or will limit some of my obvious abilities, please tell me how to cure it.
BTW If you didn't noticed the errors are:
mysqli_real_connect(): (HY000/1045): Access denied for user 'phpmyadmin'#'localhost' (using password: YES)
and
Connection for controluser as defined in your configuration failed.
Some more details:
PHP version is 7.4
Operating System is Ubuntu 20.04
I was using MaridDb solved this issue with the following:
sudo systemctl stop mariadb
sudo mysqld_safe --skip-grant-tables --skip-networking &
mysql -u root
You will see a prompt like below:
Type help; or \h for help. Type \c to clear the current input statement.
MariaDB [(none)]> FLUSH PRIVILEGES;
For MySQL 5.7.6 and newer as well as MariaDB 10.1.20 and newer
ALTER USER 'root'#'localhost' IDENTIFIED BY 'new_password';
OR:
For MySQL 5.7.5 and older as well as MariaDB 10.1.20
SET PASSWORD FOR 'root'#'localhost' = PASSWORD('new_password');
I've just installed LAMP on a new PC, and got the same problem.
Linux Mint 20 + MariaDB.
Password for root and phpmyadmin was already ok, but the error was still there.
Finally I discovered another configuration file, that sets the phpmyadmin password; you have to edit it:
$ sudo nano /etc/dbconfig-common/phpmyadmin.conf
set the correct password (= dbc_dbpass) for user dbc_dbuser='phpmyadmin'
Use ctrl-O to save, then ctrl-X to exit. Then launch the command:
$ sudo dpkg-reconfigure phpmyadmin
(Do NOT reinstall the DB).
In my PC il works!
I had a similar issue with mysql 8.0.22 and Ubunutu 20.04.3lts after installation despite setting up the phpmyadmin user during the installation it wouldn't let me in with the password I set.
I solved it by logging in at the command line using
sudo mysql
Then changed the password by the below and I could then log in
ALTER USER 'phpmyadmin'#'localhost' IDENTIFIED BY 'new-password-here';
I had the same problem by changing the password of the root user and the problem was solved by changing the content of the config.inc.php file inside the xampp\phpMyAdmin folder.
Open the file with Notepad, then enter the defined password in front of the password field and that's it
Error image
---The part where the password must be entered

MySql access denied for every command

I just installed mysql fresh on my computer. I never set any passwords nor have I set up any databases yet. Every command I try to enter into mysql is blocked because the system keeps prompting me for a password which I don't have. I've tried following many steps to reset the root password but often times when I enter a command such as:
./mysqld --skip-grant-tables --skip-networking
My terminal says something along the lines of (Errcode: 13 - Permission denied).
So can anyone suggest some file I should check or some commands I should try to set/reset the password?
Thank you
Not sure which steps you have taken this far based on your post, what OS you installed on (I am making an assumption it was on a linux distro), or whether it was from source or not but here are the steps you need to rest the root password:
How to reset the root password for mysql:
Stop mysql:
1. service mysql stop
Run mysql with skip grants to be able to login without any password
2. mysqld_safe --skip-grant-tables &
Login as root
3. mysql -u root
4. mysql commands:
mysql> use mysql;
mysql> update user set password=PASSWORD("YourPWHere") where User='root';
mysql> flush privileges;
mysql> quit
Stop mysql
5. service mysql stop
Start mysql normally:
6. service mysql start
Try to login using your new password:
7. mysql -u root -p
If that fails...I would just reinstall fresh...
During my salary instalation you should enter a password at some stage so long think you must have left the default password which is root if this doesn't work Uninstaller and reinstall paying special attention to every step

Unable to access MySQL after it automatically generated a temporary password

I have erased and installed OSX 10.11 El Capitan and I have been following through this tutorial to get MySQL up and running on the new OS X. The first step was to download MySQL For Mac OS X 10.9 (x86, 64-bit), DMG Archive (works on 10.11, they recommended in the tutorial). While I were finishing installing the MySQL, I got the message saying that :
2015-10-25T02:10:54.549219Z 1 [Note] A temporary password is generated for root#localhost: R>gFySuiu23U
If you lose this password, please consult the section How to Reset the Root Password in the MySQL reference manual.
That was weird, I have never seen that kind of message. After that, I started MySQL via the Preference Pane and then use /usr/local/mysql/bin/mysql -v command on the terminal for another step. I got an error message saying that :
ERROR 1045 (28000): Access denied for user 'cheetah'#'localhost' (using password: NO)
I have also tried to access database through Sequel Pro using root as username and blank password, I got access denied message saying that :
Unable to connect to host 127.0.0.1 because access was denied.
Double-check your username and password and ensure that access from your current location is permitted.
MySQL said: Access denied for user 'root'#'localhost' (using password: NO)
Okay, I also tried this again using root as a username but 'R>gFySuiu23U' as a password (which was generated from MySQL). I got connection failed message saying that :
Unable to connect to host 127.0.0.1, or the request timed out.
Be sure that the address is correct and that you have the necessary privileges, or try increasing the connection timeout (currently 10 seconds).
MySQL said: Your password has expired. To log in you must change it using a client that supports expired passwords.
How could I solve this problem? I remember that MySQL has never got automatically generated a temporary password like this, hasn't it ?
Try this:
mysql -u root -h 127.0.0.1 -p
Enter password: (enter the random password here)
Ref:https://dev.mysql.com/doc/refman/5.7/en/data-directory-initialization-mysqld.html
Following this, you may reset your password using
ALTER USER 'root'#'localhost' IDENTIFIED BY 'new-password';
This is what worked for me on OS X Yosemite running MySql v5.7 (installed from the .dmg).
cd /usr/local/mysql/bin
./mysql -u root -p --connect-expired-password
(Enter the temporary password generated by the installer.)
This gets you into sandbox mode and mysql> prompt. Then set desired root password with SET PASSWORD:
SET PASSWORD FOR 'root'#'localhost' = PASSWORD('mySuperSecretPassword');
Now that the password MySQL had generated is expired, the problem is reduced to getting this password to work again (1) or generate a new one (2). This can be accomplished by running MySQL with the skip-grant-tables option which would make it ignore the access rights:
Stop your MySQL server.
Add the below at the end of the [mysqld] section of my.cnf file and save it.
skip-grant-tables
Start MySQL server.
In terminal, type
mysql -u root -p
to get into MySQL command prompt.
In the command prompt, type
USE mysql;
to get into the mysql database where it keeps database users.
Type
UPDATE user SET password_expired = 'N' WHERE User = 'root';
to let MySQL know the password is not expired (1) or
UPDATE user SET authentication_string = PASSWORD('YourNewPassword'), password_expired = 'N' WHERE User = 'root';
to assign a new password YourNewPassword to root (2).
Doing these steps under OSX 10.11 El Capitan and MySQL 5.7.X, should do the trick.
Considering that you already have MySQL installed then..
Open a terminal window and type:
sudo /usr/local/mysql/support-files/mysql.server stop
sudo mysqld_safe --skip-grant-tables
Since the command fired in the step 2 will be under on going state, you need to open another terminal window and then type:
mysql -u root -p
UPDATE mysql.user SET password_expired='N', authentication_string=PASSWORD('') WHERE User='root';
quit;
sudo /usr/local/mysql/support-files/mysql.server restart
Important: in the step 2 you must replace for your password.
Hope it will wok for you.
MySQL password expired
Resetting the password will solve the problem temporarily, however, from MySQL 5.7.4 to 5.7.10 (I think to encourage better security) the default value for the default_password_lifetime variable is 360 (about a year). For those versions, if you make no changes to this variable (or to individual user accounts) all user passwords expire after 360 days.
Typically, from a script you might get the message: "Your password has expired. To log in you must change it using a client that supports expired passwords."
So, to prevent automatic password expiry, log in as root (mysql -u root -p), then, for clients that automatically connect to the server (e.g. scripts.) change the password expiration settings for those clients:
ALTER USER 'script'#'localhost' PASSWORD EXPIRE NEVER;
or you can disable automatic password expiration for all users:
SET GLOBAL default_password_lifetime = 0;
Links:
MySQL: Password Expiration and Sandbox Mode
MySQL: Password Expiration Policy
Password expiration policy in MySQL Server 5.7
I'm running macOS Sierra(10.12.3) and I installed mysql-5.7.17-macos10.12-x86_64.dmg.
The answer from #lesley worked for me with the exception that I needed to add ./ to ensure I was calling the mysql binary in my current working directory. Which is where the aforementioned package was installed.
If you cd to /usr/local/mysql/bin and run mysql -u root -p --connect-expired-password, you could receive the following error.
mysql: unknown option '--connect-expired-password'
I did. Because simply running mysql without providing a path, called a previously installed version of the MariaDB client.
So to ensure you are executing the correct binary, you can either
provide the absolute path
/usr/local/mysql/bin/mysql -u root -p --connect-expired-password
or the relative path after changing directories
cd /usr/local/mysql/bin
./mysql -u root -p --connect-expired-password
Both ways should work. Once you are connected to the client, the instruction are the same as above from #lesley.
Enter your temporary password generated by the installer and set your new password.
SET PASSWORD FOR 'root'#'localhost' = PASSWORD('yourNewPassword');
I faced the same problem. I followed the installation process guide from https://www.ntu.edu.sg/home/ehchua/programming/sql/MySQL_HowTo.html and downloaded DMG archive and installed MySQL on my MAC OS X 10.12.2.
Finally executed the following commands on new Terminal.
cd /usr/local/mysql/bin
./mysql -u root -p --connect-expired-password
It worked.
Answer 7 worked for me: El capitan, MySQL installed from dmg and autogenerated password, but made sure to cd to /usr/local/bin/mysql before entering ./mysql -root -p Obvious, but I didn't the first time.
Now to find where all my databases and tables are and how to link them in.
For Mysql 5.7 I use
shell $ > sudo grep 'temporary password' /var/log/mysqld.log
This particular one did the trick for me:
As specified in this link: https://www.variphy.com/kb/mac-os-x-reset-mysql-root-password
Do all the steps except executing
UPDATE mysql.user SET Password=PASSWORD('NewPassword') WHERE User='root';
Execute
UPDATE mysql.user
SET authentication_string = PASSWORD('MyNewPass'), password_expired = 'N'
WHERE User = 'root' AND Host = 'localhost';
And then execute
FLUSH PRIVILEGES;
The another way to solve this issue is to use an older version of MySQL instead.
I have uninstalled MySQL version 5.7.9 for Mac OS X 10.9 (x86, 64-bit), DMG Archive and then install the older version, MySQL version 5.6.7 for Mac OS X 10.9 (x86, 64-bit), DMG Archive. This issue is solved. The given autogenerated password before finishing installation of this older version is gone and I can ultimately access the database using root as username and a blank password. Everything is working like a charm!
I installed view brew, and I had the same error message until I noticed this caveat:
We've installed your MySQL database without a root password. To secure it run:
mysql_secure_installation
To connect run:
mysql -uroot
To have launchd start mysql now and restart at login:
brew services start mysql
Or, if you don't want/need a background service you can just run:
mysql.server start
I got around this problem by running
'mysql -u root -p --connect-expired-password'
Then input the expired auto-gen password from mysql. Finally got in. Selected mysql db with
'use mysql'
and then updated user 'root' pw with
'ALTER USER 'root'#'localhost' IDENTIFIED BY 'your new password'
Installing MySQL manually by downloading packages for the first time generates a default password for root. Copy and save that. If not done somehow on successive re-installations it does not show that password.
Thus you cannot login to root.
Do the following :
Find mysql related entries from system
sudo find / -name mysql
Remove all mysql related entries by doing rm -rf <mysql_entries_above>
Download latest mysql-server and intall it.
You will be promted with a default password which you need to copy.
Run mysql_secure_installation and paste that password when asked for root.
Subsequently follow the steps and change admin password when prompted for.
Restarting Mysql server worked for me.
But in Mysql80-Server, it is more complicated than 5.7. In MySQL80 not allow you to update or change password during the config in my.cnf in state "skip grant table". So you need 3 big steps to do
I) change my.cnf to skip-grant-table
II) login MySQL with blank password & update table to blank password
III) restart mysql and login with blank password and update to new password
Step to do: (whatever, you forgot root password, temporary password gen by installation not work, etc. please follow the steps below) In my case on FreeBSD 12.2
stop your mysql server by
/usr/local/etc/rc.d/mysql-server stop
recheck again whether it is really stop (in case more serious problem than that)
/usr/local/etc/rc.d/mysql-server status
mysql is not running.
find your my.cnf file and add "skip-grant-tables" to it.
(normally before [Mysqldump] head)
restart mysql
/usr/local/etc/rc.d/mysql-server start
login to mysql
mysql -u root -p
when it ask for password, just press enter and you will log into mysql
select DB to use
use mysql
look at the table user
select user, authentication_string,password_expired from user;
update to blank password
UPDATE user SET authentication_string = '', password_expired='N' WHERE User = 'root';
quit mysql and make mysql stop
goto file my.cnf then take "skip-grant-tables" out of file.
restart mysql again with "mysql -u root -p" enter the blank password
then
ALTER USER 'root'#'localhost' IDENTIFIED WITH
caching_sha2_password BY 'YourNewPassword';
quit mysql and make mysql stop
restart mysql again then you will login with your new password
This may happens when you have installed mysql before.
Try the password you set for the last version of mysql.
This did work for me.

Access denied for user 'root'#'localhost' (using password: YES) (Mysql::Error)

I tried to deploy web application on my server and I am getting this mysql database exception
Access denied for user 'root'#'localhost' (using password: YES) (Mysql::Error)
I tried to access the database from the command prompt using mysql -u root -p I am able to do all the database operations.
what is the error
java.sql.SQLException: Access denied for user 'root'#'localhost' (using password: YES)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2928)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:771)
at com.mysql.jdbc.MysqlIO.secureAuth411(MysqlIO.java:3649)
at com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:1176)
at com.mysql.jdbc.Connection.createNewIO(Connection.java:2558)
at com.mysql.jdbc.Connection.<init>(Connection.java:1485)
at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:266)
at java.sql.DriverManager.getConnection(DriverManager.java:620)
at java.sql.DriverManager.getConnection(DriverManager.java:200)
at com.mpigeon.DbConnection.DbConn(DbConnection.java:26)
at com.mpigeon.CheckLoginHome.doGet(CheckLoginHome.java:39)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
You need to grant access to root from localhost. Check this ubuntu help
try using root like..
mysql -uroot
then you can check different user and host after you logged in by using
select user,host,password from mysql.user;
check you are putting blank space in password.
From my answer here, thought this might be useful:
I tried many steps to get this issue corrected. There are so many sources for possible solutions to this issue that is is hard to filter out the sense from the nonsense. I finally found a good solution here:
Step 1: Identify the Database Version
$ mysql --version
You'll see some output like this with MySQL:
$ mysql Ver 14.14 Distrib 5.7.16, for Linux (x86_64) using EditLine wrapper
Or output like this for MariaDB:
mysql Ver 15.1 Distrib 5.5.52-MariaDB, for Linux (x86_64) using readline 5.1
Make note of which database and which version you're running, as you'll use them later. Next, you need to stop the database so you can access it manually.
Step 2: Stopping the Database Server
To change the root password, you have to shut down the database server beforehand.
You can do that for MySQL with:
$ sudo systemctl stop mysql
And for MariaDB with:
$ sudo systemctl stop mariadb
Step 3: Restarting the Database Server Without Permission Checking
If you run MySQL and MariaDB without loading information about user privileges, it will allow you to access the database command line with root privileges without providing a password. This will allow you to gain access to the database without knowing it.
To do this, you need to stop the database from loading the grant tables, which store user privilege information. Because this is a bit of a security risk, you should also skip networking as well to prevent other clients from connecting.
Start the database without loading the grant tables or enabling networking:
$ sudo mysqld_safe --skip-grant-tables --skip-networking &
The ampersand at the end of this command will make this process run in the background so you can continue to use your terminal.
Now you can connect to the database as the root user, which should not ask for a password.
$ mysql -u root
You'll immediately see a database shell prompt instead.
MySQL Prompt
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql>
MariaDB Prompt
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]>
Now that you have root access, you can change the root password.
Step 4: Changing the Root Password
mysql> FLUSH PRIVILEGES;
Now we can actually change the root password.
For MySQL 5.7.6 and newer as well as MariaDB 10.1.20 and newer, use the following command:
mysql> ALTER USER 'root'#'localhost' IDENTIFIED BY 'new_password';
For MySQL 5.7.5 and older as well as MariaDB 10.1.20 and older, use:
mysql> SET PASSWORD FOR 'root'#'localhost' = PASSWORD('new_password');
Make sure to replace new_password with your new password of choice.
Note: If the ALTER USER command doesn't work, it's usually indicative of a bigger problem. However, you can try UPDATE ... SET to reset the root password instead.
[IMPORTANT] This is the specific line that fixed my particular issue:
mysql> UPDATE mysql.user SET authentication_string = PASSWORD('new_password') WHERE User = 'root' AND Host = 'localhost';
Remember to reload the grant tables after this.
In either case, you should see confirmation that the command has been successfully executed.
Query OK, 0 rows affected (0.00 sec)
The password has been changed, so you can now stop the manual instance of the database server and restart it as it was before.
Step 5: Restart the Database Server Normally
The tutorial goes into some further steps to restart the database, but the only piece I used was this:
For MySQL, use:
$ sudo systemctl start mysql
For MariaDB, use:
$ sudo systemctl start mariadb
Now you can confirm that the new password has been applied correctly by running:
$ mysql -u root -p
The command should now prompt for the newly assigned password. Enter it, and you should gain access to the database prompt as expected.
Conclusion
You now have administrative access to the MySQL or MariaDB server restored. Make sure the new root password you choose is strong and secure and keep it in safe place.
I faced the same error after upgrading MySQL server from 5.1.73 to 5.5.45
There is another way to fix that error.
In my case I was able to connect to MySQL using root password but MySQL actively refused to GRANT PRIVILEGES to any user;
Connect to MySQL as root
mysql -u root -p
then enter your MySQL root password;
Select database;
use mysql;
Most probably there is only one record for root in mysql.user table allowing to connect only from localhost (that was in my case) but by the default there should be two records for root, one for localhost and another one for 127.0.0.1;
Create additional record for root user with Host='127.0.0.1' if it's not there;
SET #s = CONCAT('INSERT INTO mysql.user SELECT ',
REPLACE((SELECT GROUP_CONCAT(COLUMN_NAME)
FROM INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_NAME = 'user' AND TABLE_SCHEMA = 'mysql')
,"Host","'127.0.0.1'"),
' FROM mysql.user WHERE User="root"');
PREPARE stmt FROM #s;
EXECUTE stmt;
Additionally to that you can execute mysql_upgrade -u -p
to see if everything is ok.
This error happens if you did not set the password on install, in this case the mysql using unix-socket plugin.
But if delete the plugin link from settings (table mysql.user) will other problem. This does not fix the problem and creates another problem. To fix the deleted link and set password ("PWD") do:
1) Run with --skip-grant-tables as said above.
If it doesnt works then add the string skip-grant-tables in section [mysqld] of /etc/mysql/mysql.conf.d/mysqld.cnf. Then do sudo service mysql restart.
2) Run mysql -u root -p, then (change "PWD"):
update mysql.user
set authentication_string=PASSWORD("PWD"), plugin="mysql_native_password"
where User='root' and Host='localhost';
flush privileges;
quit
then sudo service mysql restart. Check: mysql -u root -p.
Before restart remove that string from file mysqld.cnf, if you set it there.
#bl79 is the author of this answer, i've just reposted it, because it does help!
My application is using Mura CMS and I faced this issue. However the solution was the password mismatch between my mysql local server and the password in the config files. As soon as I synched them it worked.
I solved this problem by deleting the empty users creating by MySQL. I only have root user and my own user. I deleted the rest.
Update the empty password in the table mysql.user of mysql
use mysql;
select host,user,password from mysql.user;
update mysql.user set password = PASSWORD('123456') where password = '';
flush privileges;
Update user table in mysql DB. And set some password where it is blank, i was using root user so i set password for root user.
update mysql.user set password = PASSWORD('123456') where password = '';
flush privileges;
And then again tried from ATG CIM by providing password and it worked fine.
http://i.stack.imgur.com/3Lchp.png
I got this problem today while installing SugarCRM (a free CRM).
The system was not able to connect to the database using the root user. I could definitively log in as root from the console... so what was the problem?
I found out that in my situation, I was getting exactly the same error, but that was because the password was sent to mysql directly from the $_POST data, in other words, the < character from my password was sent to mysql as < which means the password was wrong.
Everything else did not help a bit. The list of users in mysql were correct, including the anonymous user (which appears after the root entries.)
I googled a lot but did not find a definite answer to my problem. I used KeyPass to generate a strong password and could use it successfully on mysql workbench to connect but not from the command line. So I changed the psw to an easy one and it worked on the command line. I have managed to create a strong password that was able to connect from the terminal. So my advise is, try with an easy password first before trying all kind of things.
I was running UTs and I started receiving error messages. I am not sure what was the problem. But when I changed my encoding style in INTELLIJ to UTF8 it started working again.
access denied for user 'root'#'localhost' (using password yes)
hibernate
this is my URL
db.url=jdbc:mysql://localhost:3306/somedb?useUnicode=true&connectionCollation=utf8_general_ci&characterSetResults=utf8&characterEncoding=utf8
Add a user option in msyql.
GRANT PROXY ON ''#'' TO 'root'#'localhost' WITH GRANT OPTION;
and this link will be useful.