systemctl status mysql.service
systemctl stop mysql.service
ps -eaf|grep mysql
If mysqld_safe Directory '/var/run/mysqld' for UNIX socket file don't exists
sudo mkdir -p /var/run/mysqld
sudo chown mysql:mysql /var/run/mysqld
sudo mysqld_safe --skip-grant-tables &
[1] 28088
2022-05-09T18:18:53.504935Z mysqld_safe Logging to '/var/log/mysql/error.log'.
2022-05-09T18:18:53.533285Z mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
mysql> UPDATE mysql.user SET authentication_string=null WHERE User='root';
Query OK, 1 row affected (0.01 sec)
Rows matched: 1 Changed: 1 Warnings: 0
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
mysql> ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'root_password';
Query OK, 0 rows affected (0.02 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
mysql> exit
Bye
sudo systemctl restart mysql.service
mysql --version
mysql Ver 8.0.29-0ubuntu0.22.04.2 for Linux on x86_64 ((Ubuntu))
No comments:
Post a Comment