mysql password unrecognized after exit terminal - mysql

i'm new in sql.
I have mamp.
I program in terminal and i don't understand why my password for connect to mysql doesn't work after a first connection.
If I'm connect for first time after launch mamp, it work. But after it says password incorrect ...
I don't understand why because I can connect if I restart mamp with the same password.
Anyone have answer ?
thx for time.

Related

MySQL Workbench Root Password

Just had helpdesk install mySQL Workbench but when trying to connect to a new connection i am asked for a root password. I try to connect without putting in the password but am thrown an error.
After research i found that whoever installs your mySQL will set up the root password. i eventually got the password from help desk

Failed to connect to MySQL at localhost:3306 with user root (MySQL Workbench)

I am not connecting MySQL server. I didn't change password. I got following errors.
Connect server error:
Test connection error:
How to solve this problem?
Thank you.
have you tried connecting from a terminal ?
mysql -u root -p -h localhost -P 3306
You can try to reconfigure the password using the installer you downloaded to install Mysql in your machine.
Steps:
Double click your installer
select reconfigure link next to MYsql server
click next till you were asked to set up password. Then Enter your password
Click execute. and you are done. ou can try to connect again.
Check this video for reference.
https://www.youtube.com/watch?v=8L1GKGLmyUk

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

MySQL Workbench error when adding a connection

I'm new to mac and mySQL. I installed mySQL 5.6.14 and mySQLWorkbench 1.6. I turned on mySQL in system preferences.
Then I went into workbench, clicked to add a new connection and filled in the details: host is localhost; username is root; password is empty/nothing. Tested the connection and its all good.
Clicked OK and got this error: Exception caught while processing action from home screen: error calling Python module function WbAdmin.autoDetectLocalInstance.
I also can not access mySQL from the terminal.
I've googled and can't find anything. Has anyone got any ideas of what could be wrong something I could try to fix it.
I've had de same problem. For me the solution:
Check that you have the file /etc/my.cnf
if you don't have sudo cp my-default.cnf on the terminal
Try to put password Virlli$ sudo /usr/local/mysql/bin/mysqladmin -u root password 'password'
Restart Mysql and Workbench
for Mysql :sudo /usr/local/mysql/support-files/mysql.server stop
If you are a mac your default password is root . Same as the username.
I've had the same problem. I solved this issue by getting settings section from main window and then connecting from appeared connection from the main window.

Locked out of MySQL server - CentOS

I have a server running CentOS and I installed myphp, phpmyadmin, mysql, mysql-server and it asks me for a password when trying to run the mysql safe install. I have not set a password and it says if you have not set one, then press enter, but this doesn't not work. Also I can't stop mysql and reinstall because that gives me the error:
mysql access denied for user 'root'#'localhost'
I've looked about a few places online and I cant find any fixes.
If it's possible, shut down the mysql daemon (service mysql stop). You can start it in safe mode to skip authorization with mysqld --skip-grant-tables. Then you can connect to it as root without password and reset the password.
Ok so what I did was service mysql stop and then mysqld_safe --skip-grant-tables & whilst I was in the root directory. What I did not realise was that when I do this, I am now in the SQL command line. This was my first time using mysql and so when the [root#blahblah] wasn't showing in the left side, I thought that the process has crashed but that was not true. Once I realised that I was actually in the SQL command line I was able to change my password.