macos configure mysql access denied for user 27root 27 40 27localhost 27

Solutions on MaxInterview for macos configure mysql access denied for user 27root 27 40 27localhost 27 by the best coders in the world

showing results for - "macos configure mysql access denied for user 27root 27 40 27localhost 27"
Dagmar
12 Oct 2017
1You can do the following on Mac (El Capitan)
2
3Open a Terminal window, use the command below to stop mysql if it's already running.
4
5sudo /usr/local/mysql/support-files/mysql.server stop
6
7You can also check System Preferences > MySQL to see if it is running
8
9Start MySQL with this command:
10
11sudo /usr/local/mysql/bin/mysqld_safe --skip-grant-tables
12
13Open a new terminal window/tab:
14
15sudo /usr/local/mysql/bin/mysql -u root
16
17This should open "mysql" prompt. Execute the following command:
18
19$mysql> UPDATE user SET authentication_string=PASSWORD("my_password") WHERE User='root';
20
21Troubleshooting tips:
22
23A) The command for MySql versions before 5.7 was:
24
25$mysql> UPDATE user SET Password=PASSWORD('my_password') where USER='root';
26
27B) If you see ERROR 1046 (3D000): No database selected, then run this command first:
28
29use mysql;
30
31C) If you see unknown "Password" field error, then run this command:
32
33UPDATE USER SET AUTHENTICATION_STRING=password('NewPassword') WHERE user='root';
34 $mysql> FLUSH PRIVILEGES;
35 $mysql> EXIT
36
37Stop MySql server
38
39sudo /usr/local/mysql/support-files/mysql.server stop
40
41Restart MySQL, either through System Preferences > MySql or using a command.