Can't connect to MySQL - mysql

I'm trying to connect to MySQL, using Sequel Pro, something I have done many times before. Host 127.0.0.1, username root, no password. I get the following message:
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)
For what it's worth, I got this message after upgrading to a new Mac OS (Mavericks), realized that the server wasn't running, downloaded a new server (which is currently running), and tried again - but I had the same problem.

Make sure you are running MySql in background System Preferences -> Mysql -> Start MySql
Make sure you are able to connect to MySql through command line, if command line works, there is no reason why it should not work in SequelPro.
If problem still persists, try changing the 'root' password.

It happened to my in Mac. I went to system preferences -> MySQL -> Stopped the server, started it again, and it worked.

Related

phpMyAdmin - "Cannot log in to the MySQL server"

I just recently installed MySQL (Ver 8.0.32) and phpMyAdmin on my CentOS 7 machine, however, every time I try to login to phpMyAdmin it says I cannot login. The MySQL database is up and running as I am able to log into it via the command line using root as the username and the password I had set on install.
I have tried creating a new user with full access and privileges (which I can log into via the command line as well) but phpMyAdmin returns the same "Cannot log into the MySQL server" error even though everything is correct.
I have tried updating the MySQL port, I have tinkered with /etc/phpMyAdmin/config.inc.php to use the proper host of the machine, the port, socket, connect_type, auth_type, user, password, etc. I have tried every solution that was recommended online and yet nothing. I cannot login to phpMyAdmin and I am unsure as to why (I can't find any logs regarding the issue either).
Can anyone help? I am so annoyed and I do not know what else to do.

MySQL Workbench cannot connect to database in Ubuntu 20.04

I cannot open the local instance in MySQL Workbench in Ubuntu 20.04 after installing the MySQL server. I searched for some similar topics here but these did not help.
Solution Found:
I've found the solutions for this problem. This was because of the MySQL Workbench couldn't store password in keychain and also because it failed to connect to mysql at 127.0.0.1:3306 with user root access denied for user 'root'#'localhost'(using password:YES).
Use this command in the terminal: sudo snap connect mysql-workbench-community:password-manager-service :password-manager-service.
The snap package is sandboxed as usual and is not by default allowed to access the service. MySQLWorkbench is blocked by AppArmor when we choose "Store in keychain" option. That's why we need to enter the command to allow the package to access the service.
The solution links that helped me:
MySQL Workbench not saving passwords in keychain
Failed to connect to mysql at 127.0.0.1:3306 with user root access denied for user 'root'#'localhost'(using password:YES)
All I need to do here is mainly type the following command in the terminal:
sudo snap connect mysql-workbench-community:password-manager-service :password-manager-service
Here, the snap package is sandboxed as usual and is not by default allowed to access the service. MySQLWorkbench is blocked by AppArmor when we choose "Store in keychain" option. That's why we need to enter the command to allow the package to access the service.
Try adding this step.
login to mysql in the terminal
execute this command
ALTER USER 'root'#'localhost' IDENTIFIED WITH mysql_native_password BY 'password';
Check if this solved your problem <NOTE THE 'password' PART, CHANGE IT TO THE PASSWORD YOU WANT TO USE>
I tried all of the above steps, this one was the one that solved for me.
Make sure all the mentioned things working.
First check mysql is running by running below command:
sudo systemctl status mysql
If it's running make sure that your mysql username is root and password you are entering is correct. If still not working make sure you have given all the privileges to user "root".
If don't know how to set privileges read this article carefully.
https://docs.rackspace.com/support/how-to/install-mysql-server-on-the-ubuntu-operating-system/

Mysql won't start server during installation

I am trying to install mysql5.54 on windows 10 (1909) on a computer. Using Mysql latest installer.
Using port 3308
I have two issues:
1: I have to uncheck "Server data file" to complete install. (If I leave it checked, it always tells me it failed during installation)
During "Apply configuration", it stops in "Starting the server" for ever.
Can someone tell me how to trace the problem? I've installed this for many times, never had this problem previously.
I have mysql 5.7 installed on another port 3306, I don't think this will be the case.
I tried to run mysql.exe cmd line, it said:
ERROR 1045 (28000): Access denied for user 'root'#'localhost' (using password: YES)
why it is denied my root user?
Thanks,
you should consider using docker or a vm, running two sql server on one computer can cause trouble obviously.
But i think you should choose only a different path for your second server
https://dev.mysql.com/doc/mysql-installer/en/mysql-installer-change-path-proc.html
So mysql can use it to store its cnf/ini filr an use a different data folder

MySQL refuses to connect when two instances of mysql created in win10 and ubuntu (dualboot)?

I'm running a dualboot system on the same ssd(one partition for Ubuntu 19.04, one for windows 10 home 1903). Both currently have MySQL 8.0 installed on them, with the same 'root' user and same password.
Before I installed mysql on ubuntu, I ran a single instance of mysql on Windows 10for my projects perfectly fine(workbench, terminal(cmd, rather) could both connect to root)
Then i installed ubuntu and(stupidly) named the mysql server user as 'root' as well, with the same password.
And now both mysql in both OS refuses to connect with the error:
"Error Nr. 1045 access denied for user 'root'#'localhost' (using password: YES)"
Trying mysql -u root wouldnt work either, throwing the error
"Error Nr. 1045 access denied for user 'root'#'localhost' (using password: NO)"
I'd really love to know why this error occurs and how I could possibly run two instances on two OS's(in the first place when the Ubuntu is shut down that instance isnt running nor listening on 3306 anymore, so why should this error occur?)
Password is definitely correct and the standard google search replies to reset the password didnt change anything either.
Thanks! :)
Did your mysql on Ubuntu and Window shared the same data directory ? Anyway, what worked for me is reinstall mysql on both platforms

phpmyadmin is denying me access when I try and use it through http://localhost/xampp homepage

I am using a mac laptop running mac os x version 10.5.8 and I need to export a database to an .sql file so I can push it to github for a project. However when I attempt to use phpmyadmin for this through the localhost homepage, when I click on the link it responds with a page with just this error message:
MySQL said:
1045 - Access denied for user 'root'#'localhost' (using password: NO)
phpMyAdmin tried to connect to the MySQL server, and the server rejected the connection. You should check the host, username and password in your configuration and make sure that they correspond to the information given by the administrator of the MySQL server.
But it doesn't even prompt you for user information to begin with? is there something I am missing? someone please help
The problem is in your phpmyadmin configuration on the server.
You can see the documentation here: http://www.phpmyadmin.net/documentation/#setup_script
The setting you are looking for is "$cfg['Servers'][$i]['auth_type']" - set this to 'HTTP', and you will be able to input a username and password.
To resolve the above error:-
a) Open Mysql console from the tray of WAMP server
b) It will ask for password(you might have set this password earlier when u installed MySql in your system)(In my case it is admin)
c) Enter admin (press enter)
Now it means your phpmyadmin is assuming no password for your MySql and unable to connect MySql but yor are able to connect your MySql Server by providing password
For this Open config.inc file from the below path
C:\wamp\apps\phpmyadmin4.1.14
And replace this line
$cfg['Servers'][$i]['password'] =’ ’;
to `$cfg['Servers'][$i]['password'] = 'admin';
I hope it will work..
Turn off your Firewall and then connect to phpmyadmin. It should open. Then turn on Firewall again. Worked for me.