Ask Your Question

Revision history [back]

Hi, at normal situation during first running the mysql has a blank password and propose it to set.

# mysql_secure_installation
/usr/bin/mysql_secure_installation: line 379: find_mysql_client: command not found

NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
      SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!

In order to log into MariaDB to secure it, we'll need the current
password for the root user.  If you've just installed MariaDB, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.

Enter current password for root (enter for none):
OK, successfully used password, moving on...

Setting the root password ensures that nobody can log into the MariaDB
root user without the proper authorisation.

Set root password? [Y/n] y
New password:
Re-enter new password:
Password updated successfully!
Reloading privilege tables..
 ... Success!

If you still have no access the mysql password can reset quite easily:
Define mysql user:

ps aux | grep sql

create file like:

echo "SET PASSWORD FOR 'root'@'localhost' = PASSWORD('123qwe'); > /var/log/mysql.reset

set correct permissions:

chown mysql:mysql /var/log/mysql.reset

start mysql:

sudo -u mysql mysqld_safe --init-file=/var/log/mysql.reset &

login to mysq:

mysql -u root -p
Enter password: 123qwe
exit;

Stop all mysql processes and start server normally.
Full instruction you can find there: http://dev.mysql.com/doc/refman/5.7/en/resetting-permissions.html

Good luck.