mac os reset mysql password

If you have forgot the MySQL root password, can’t remember or want to break in….. you can reset the mysql database password from the command line in either Linux or macOS Sierra and OSX as long as you know the root user password of the box you are on, this is for MySQL 5.7 onwards:mysql

Stop MySQLsql

sudo /usr/local/mysql/support-files/mysql.server stop

Start it in safe mode:shell

sudo mysqld_safe --skip-grant-tables

This will be an ongoing command until the process is finished so open another shell/terminal window, and log in without a password as root:this

mysql -u root
FLUSH PRIVILEGES;
ALTER USER 'root'@'localhost' IDENTIFIED BY 'MyNewPass';

Change the lowercase ‘MyNewPass’ to what you want – and keep the single quotes.server

\q

Start MySQLip

sudo /usr/local/mysql/support-files/mysql.server start

Thats it, now your root password will be updated.rem

相關文章
相關標籤/搜索