MySQL Workbench Cannot Connect to Database Server - mysql

I have exactly the same problem as the poster in question 7864276 except that in my case I've verified that the server is actually running, e.g., from within MySQL Workbench by right-clicking on Local Instance MySQL and selecting Start Command Line Client. It's only when I select Query Database or double click on Local Instance MySQL that the error message results. One additional piece of information in the error message is that it says "invalid for this platform requested(MYSQL_PROTOCOL_SOCKET)". Everything worked fine until I recently updated MySQL Workbench to version 5.2.47 CE.

Click on Manage Connections. Select Local Instance MySQL. Change Connection Method to Local Socket/Pipe. Test connection succeeds now.

TERMINAL:
sudo mysql -u root ENTER
you password user ENTER
USE mysql; ENTER
UPDATE user SET plugin='mysql_native_password' WHERE User='root'; ENTER
FLUSH PRIVILEGES; ENTER
exit; ENTER
service mysql restart ENTER
you password user again ENTER
finish you terminal, and enter Mysql Workbench, in Mysql Connections "key icon", local instance 3306, and Test connection.

Related

Can't reset MySQL password

I had some tweaking for my server and unfortunately I can't log to phpmyadmin via whm anymore nore via ssh as I have access denied for root#localhost.
I tried to change my sql root password via whm but it give me the following error :
Unable to reset the MySQL root password.
The subprocess reported error number 1 when it ended.
Can anyone help me?
You'll have to check if you are able to login to mysql from a command prompt. Login to your server via SSH and issue a mysql. It should login to your mysql server.
If that doesn't work then do a cat /root/.my.cnf. There you should have the previous mysql root password. Copy that password and try this:
mysql -u root -p (then when prompted paste the password if you have copied earlier).
If you get an authentication failed message then that password is not the correct one and you have to manually change (you said you can't change it from WHM).
Do you use a local mysql server or a remote mysql server?
In order to change the mysql root password you have to stop the mysql service on the server and start it manually with skip grants option.
Depending on your CentOS version you have to options to stop the mysql service:
- CentOS 6.x - /etc/init.d/mysql stop
- CentOS 7.x - systemctl stop mysql
Then manually start the mysql service:
mysqld_safe --skip-grant-tables
Then issue the following:
mysql --user=root mysql
update user set Password=PASSWORD('new-password') where user='root';
flush privileges;
exit;
Restart mysql and you should be able to login with your new password. You might also want to save it in /root/.my.cnf as well.
I hope it helps!
Bogdan, seems you have to issue one more command: use mysql;
And it's quite possible that issuing the command: update user set Password=PASSWORD('new-password') where user='root';
you will be errored that there is no field Password. It happens if you're running mysql server version 5.7+. In such case change command as follows:
use mysql;update user set authentication_string=PASSWORD('new-password') where user='root';

Is MySQL root password too complex on installation on windows?

Upon installing MySQL from Oracle on my Windows machine I was prompted to enter a root password for the MySQL server. I set the following password:
eL;(4QWe-nIhq'A%t#cpJN{7PaVwvcTcsdGAYx8K
Now when I try to change settings on this server the installer asks me for my root password. When I try to type this I get the following error:
Unhandled Exception has occured in your application. If you click
Continue, the application will ignore this error an attempt to
continue. If you click Quit, the application will close immediately.
Keyword not supported.
Parameter Name: (4QWe-nIhq'A%t#cpJN{7PaVwvcTcsdGAYx8K; protocol.
Is the solution just to work with a simpler password?
I solved this problem by reinstalling the server. Another method to resetting the password is as follows:
documenation
Log on to your system as Administrator.
Stop the MySQL server if it is running. For a server that is running as a Windows service, go to the Services manager: From the Start menu, select Control Panel, then Administrative Tools, then Services. Find the MySQL service in the list and stop it.
If your server is not running as a service, you may need to use the Task Manager to force it to stop.
Create a text file containing the password-assignment statement on a single line. Replace the password with the password that you want to use.
MySQL 5.7.6 and later:
ALTER USER 'root'#'localhost' IDENTIFIED BY 'MyNewPass';
MySQL 5.7.5 and earlier:
SET PASSWORD FOR 'root'#'localhost' = PASSWORD('MyNewPass');
Save the file. The example assumes that you name the file C:\mysql-init.txt.
Open a console window to get to the command prompt: From the Start menu, select Run, then enter cmd as the command to be run.
Start the MySQL server with the special --init-file option (notice that the backslash in the option value is doubled):
C:\> cd "C:\Program Files\MySQL\MySQL Server 5.7\bin"
C:\> mysqld --init-file=C:\\mysql-init.txt

mysql: permission error starting a server

I installed mysql community server on my macbook. A password for the user "root#localhost" was created. I have this saved. When I tried to create a connection in mysql admin I noticed that the "default" user was "loisgh". When I try to start the connection using the generated password I get an error that the password is incorrect.
Please advise on how I can create a password for user loisgh OR login as root. I don't see a place where I can enter a user ID.
You can use this command to connect mysql server:
mysql -uroot -p yourpwd
After successful connect to server , to delete the account "loisgh"

login error mysql command line 5.6

I installed mysql 5.6 on windows 7(32 bit).
When I open command line client 5.6 it asks me for password i put password (mysql) and press enter, it gives connection id number, meaning connection was successful. I created a database by the name bank
create database bank;
it was created.
I created the lrngsql database user with full privileges on the bank database using following command
Grant all privileges on bank.* to 'lrngsql'#'localhost' identified by 'xyz';
It was successful too. Now here my query begins, how do i login to this user (lrngsql). the command i m typing in prompt
mysql>use bank;
-- it says Database changed.
then i type following command to login to lrngsql
mysql -u lrngsql -p xyz;
but it gives me error please help me what should i exactly type in order to get in to lrngsql user on bank database. thank you
If you're already logged in, you need to log out in order to log in again with another user. You can cancel your connection with the quit command.
Just type quit in the prompt and the connection will be closed.

Cannot Connect to Database Server mysql workbench

I'm trying to connect to mysql workbench but I get the following error
Error Message
Cannot Connect to Database Server
Your connection attempt failed for user 'root' from your host to server at
127.0.0.1:3306:
Could not open database.
Please:
1. Check that mysql is running on server 127.0.0.1
Check that mysql is running on port 3306 (note: 3306 is the default, but this can be changed)
Check the root has rights to connect to 127.0.0.1 from your address (mysql rights define what clients can connect to the server and from which machines)
Make sure you are both providing a password if needed and using the correct
password for 127.0.0.1 connecting from the host address you're connecting
When I Test Connection, the parameters are correct, and actually I can enter and manage database in console.
When I installed Mysql for first time I could enter to Workbench one time and if I closed Workbench I had to restart my PC to connect another time.
I reinstalled 2 or 3 times Mysql server and Workbench and now I cannot connect from Workbench even once.
I faced similar issue and resolved it by following these steps:
In the terminal, execute this command
mysql -u root -p -h localhost -P 3306
Enter the password
This will be displayed
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 18
Server version: 8.0.16 Homebrew
Now do,
ALTER USER 'root'#'localhost' IDENTIFIED WITH mysql_native_password BY 'root';
Now you should be able to login and connect to DB in the workbench with password 'root'
I don't know if it helps anyone, but I had the same problem on windows after updating from MySQL 5.7 to 8.0.
The solution for me was to go to services.msc, stop the MySQL service and start the "MySQL80" service instead.
Then I restarted MySQL Workbench (run as admin) and it worked.
Please make sure that You have Downloaded MySQl server while dowloading MySQl workbench from MySQl installer (if you have checked Custom download)
I had the same issue a few days ago. As I could see in the original question, there has been multiple MySQL installation on the same computer - the same flow I tried after failing in the first attempt.
In the case we are trying to reinstall MySQL, we should be aware of remaining hidden files after MySQL has been uninstalled for the first time. In order to remove them all (and make one successful installation), we should:
Make hidden files visible on your computer (instructions)
Delete all files related to MySQL after choosing uninstalling of the MySQL (I had to check C://ProgramData hidden folder)
Try a new installation
I think that during the first installation, I didn't have all required dependencies on the computer (for example Python) and the installation failed. After installing it, uninstalling the MySQL, and taking steps from above, I finally managed to run it successfully :)
I hope this could help someone! :)
This solved it for me (MAC OS)
Open MySQL from System Preferences > MySQL
Click 'Stop MySQL Server' if the server is running
Select 'Initialize Database'
Type your new password.
Choose 'Use legacy password'
Start the Server again.
Now connect the MySQL Workbench