I just wiped my Mac and did a fresh install of El Capitan. I\'m struggling to connect to Mysql now. Having gone through a web server setup process, I\'ve created a simple PH
restart MySQL server with --skip-grant-tables option And then set a new root password
$ mysql -u root
mysql> USE mysql;
mysql> UPDATE user SET password=PASSWORD("NEWPASSWORD") WHERE User='root';
mysql> FLUSH PRIVILEGES;
mysql> quit
Now if you need, you can update mysql.user table(field password_expired='N') not to expire the password.
Just open MySQL Workbench and choose [Instance] Startup/Shutdown and click on start server. It worked for me
I went through the same issue recently while installing mysql on mac os x capitan. I did not find the correct answer here, so adding this answer.
MySql in current versions, generates a temporary password when you install mysql. Use this password to set a new password using the mysqladmin utility as below;
/usr/local/mysql/bin/mysqladmin -u root -p'<your temp password>' password '<your new password>'
Hope it helps you and others.
mysqladmin -u [username] -p password
worked for me on OS X El Capitan and MySQL 5.7.12 Community Server. Example:
$ /usr/local/mysql/bin/mysqladmin -u root -p password
Enter password:
New password:
Confirm new password:
Warning: Since password will be sent to server in plain text, use ssl connection to ensure password safety.
This is similar to pavan sachi's answer, but with password prompts.
My error was "#1862 - Your password has expired. To log in you must change it using a client that supports expired passwords." at phpMyAdmin login screen first time.
start MYSQL in safe mode
mysqld_safe --skip-grant-tables &
Connect to MYSQL server
mysql -u root
run SQL commands to reset password:
use mysql;
SET GLOBAL default_password_lifetime = 0;
SET PASSWORD = PASSWORD('new_password');
Last step, restart your mysql service
WARNING: this will allow any user to login
I had to try something else. Since my root password expired and altering was not an option because
Column count of mysql.user is wrong. Expected 45, found 46. The table is probably corrupted
temporarly adding skip-grant-tables
under [mysqld]
in my.cnf
and restarting mysql did the trick