Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock'
Firstly I kill all mysqld's process with
$sudo killall -9 mysql
But nothing to show.
Wait wait, I see /var/run/mysqld/mysqld.sock, but I couldn't found this.
Finally I found the solution:
$sudo /etc/init.d/mysql stop
$sudo mkdir /var/run/mysqld/
$sudo chown mysql /var/run/mysqld/
$sudo mysqld_safe --skip-grant-tables &
mysql -uroot
>use mysql;
>update user set authentication_string=PASSWORD("NEW_PASSWORD") where User='root';
>flush privileges;
>quit;
>sudo /etc/init.d/mysql stop
>sudo /etc/init.d/mysql start
However you also can do this to update mysqld's password.
>ALTER USER 'root'@'localhost' IDENTIFIED BY 'new_password';
>flush privileges;
>quit;
Hope this help,
Tiến Phan - R0039
Knowledge is Endless
Sharing for Success
0 nhận xét:
Post a Comment