Post

Reset MariaDB Password In Slackware Linux

Yesterday, i finished setup mysql a.k.a MariaDB for develop a website in my machine and today i forget the mariaDB password.

For my documentation, i will always create this post for personal and i think might beneficial as well to people who have not knew.

So for reset mysql password in slackware, just open konsole (kde) and follow this instruction for reset.

  • First stop service mysql daemon with command /etc/rc.d/rc.mysqld stop
  • After stop service, then type mysql with comand /usr/bin/mysqld_safe –skip-grant-tables &
  • Then type mysql -u root
  • After entered or login to mariaDB, type this command use mysql then update user set password=PASSWORD(“new-password”)
  • Type flush privileges then type quit
  • Stop daemon service again /etc/rc.d/rc.mysqld stop and start again. See this example in below:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
bash-4.3# /usr/bin/mysqld_safe --skip-grant-tables &[1] 2200
bash-4.3# 160622 05:08:20 mysqld_safe Logging to '/var/lib/mysql/arief-jr.err'.160622 05:08:20 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql

bash-4.3# mysql -u root
Welcome to the MariaDB monitor.  Commands end with ; or \g.Your MariaDB connection id is 2Server version: 10.0.25-MariaDB MariaDB Server
Copyright (c) 2000, 2016, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> use mysql;Reading table information for completion of table and column namesYou can turn off this feature to get a quicker startup with -ADatabase changed
MariaDB [mysql]> update user set password=PASSWORD("arief-jr") where User='root';
Query OK, 3 rows affected (1.03 sec)Rows matched: 3  Changed: 3  Warnings: 0
MariaDB [mysql]> flush privileges;
Query OK, 0 rows affected (0.00 sec)
MariaDB [mysql]> quit
Bye

bash-4.3# /etc/rc.d/rc.mysqld stop
bash-4.3# /etc/rc.d/rc.mysqld start
bash-4.3# 160622 05:10:07 mysqld_safe Logging to '/var/lib/mysql/arief-jr.err'.160622 05:10:07 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
bash-4.3# mysql -u root -p
Enter password: 
Welcome to the MariaDB monitor. Commands end with ; or \g.Your MariaDB connection id is 3Server version: 10.0.25-MariaDB MariaDB Server
Copyright (c) 2000, 2016, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]> quit
Bye
bash-4.3# 

Now you can using mysql again, happy coding! Thanks

This post is licensed under CC BY 4.0 by the author.