şöyle birşey buldum işe yarar mı bilmiyorum
How to reset MySQL or MariaDB root password?
1. First you need to stop MySQL or MariaDB server.
root@localhost:# service mariadb stop
root@localhost:~# service mysql stop
2. Start the MySQL/MariaDB server without loading the grant tables.
root@localhost:~# mysqld_safe --skip-grant-tables &
When the --skip-grant-tables option is used, anyone can connect to the database server without a password and with all privileges granted.
3. Log in to the Mysql or MariaDB shell
root@localhost:~# mysql -u root
4. Set a new password.
Type the following command, replacing "new-password" with the new root password
MariaDB [(none)]> UPDATE mysql.user SET Password=PASSWORD('new-password') WHERE User='root';
MariaDB [(none)]> FLUSH PRIVILEGES;
MariaDB [(none)]> exit;
In old version of mariadb run the following command. Replace 'new password' with the new root password
MariaDB [(none)]> FLUSH PRIVILEGES;
MariaDB [(none)]> ALTER USER 'root'@'localhost' IDENTIFIED BY 'new_password';
5. Stop the MySQL server using the following command. You will be prompted to enter the new MySQL root password before the MySQL server shuts down:
root@localhost:~# mysqladmin -u root -p shutdown
Make sure to kill all the running mariadb process (pkill).
6. Start the MySQL/MariaDB server normally
root@localhost:~# service mariadb start
7. Once started you can check the status of MariaDB service using service mariadb status command as shown below:
root@localhost:~#service mariadb status
8. Log in to MariaDB with New Password
Test the new reset MariaDB root password by logging in to the Server using mysql -u root -p command as shown below. Once you provide the root password it should allow you to log in just the way it is described below.