reset mysql-mariadb root password in linux



Reset MySQL/MariaDB Root Password

Step 1:
Stop MySQL/MariaDB Service
CentOS/RHEL 7 Ubutu 16
systemctl stop mysqld/mariadb

CentOS/RHEL 6/5 Ubuntu 14

service mysqld stop

Step 2:
Start the MySQL daemon with “ mysqld_safe”

mysqld_safe –skip-grant-tables

Press CTRL+z to suspend a process by sending it the signal SIGSTOP

Step 3 :

Login DATABASE without Password

mysql –user=root mysql

Step 4 :

Update Root Password

update user set Password=PASSWORD(‘new-password’) where user=’root’;
OR
set password for ‘root’@’localhost’=password(‘new-password’);
flush privileges;
exit;

Step 5:

kill all mysql Process and restart mysql/mariadb service

pkill -9 myslqd
CentOS/RHEL 7, Ubuntu 16

systemctl restart myslq/mariadb
CentOS/RHEL 7, Ubuntu 16

service mysqld/mariadb restart.

Nguồn: https://inkstitch.net

Xem thêm bài viết khác: https://inkstitch.net/cong-nghe

Views:
46
Article Tags:
Article Categories:
Công Nghệ

Leave a Reply

Your email address will not be published. Required fields are marked *