Reset maria DB password on Plesk

Is it mysql or maria?

# service mysqld status
Redirecting to /bin/systemctl status  mysqld.service
mysqld.service
   Loaded: not-found (Reason: No such file or directory)
   Active: inactive (dead)

]# systemctl status mariadb.service
mariadb.service - MariaDB database server
   Loaded: loaded (/usr/lib/systemd/system/mariadb.service; enabled)
   Active: active (running) since Mon 2015-10-05 21:03:57 EST; 3min 30s ago
  Process: 26953 ExecStartPost=/usr/libexec/mariadb-wait-ready $MAINPID (code=exited, status=0/SUCCESS)
  Process: 26922 ExecStartPre=/usr/libexec/mariadb-prepare-db-dir %n (code=exited, status=0/SUCCESS)
 Main PID: 26952 (mysqld_safe)
   CGroup: /system.slice/mariadb.service
           ├─26952 /bin/sh /usr/bin/mysqld_safe --basedir=/usr
           └─27120 /usr/libexec/mysqld --basedir=/usr --datadir=/var/lib/mysql --plugin-dir=/usr/lib64/mysql/plugin --log-error=/var/log/mariadb/mariadb.log --pid-file=/var/run/mariadb/mariadb.pid --socket=/var/lib/mysql/mysql.sock

Oct 05 21:03:55 domain.com mysqld_safe[26952]: 151005 21:03:55 mysqld_safe Logging to '/var/log/mariadb/mariadb.log'.
Oct 05 21:03:55 domain.com mysqld_safe[26952]: 151005 21:03:55 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
Oct 05 21:03:57 domain.com systemd[1]: Started MariaDB database server.

Find the existing password

# cat /etc/psa/.psa.shadow
$AES-128-CBC$MnglmyKq3wJbZVgmb4YKTQ==$p/zX+xpnhJ20kIrrZiFsq7VLE3kI+86JwVdPYJtWdEE=[root@69-64-92-195 ~]#

Stop the database

]# systemctl stop mariadb.service

Edit my.cnf and add skip-grant-tables

[mysqld]
local-infile=0
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
# Settings user and group are ignored when systemd is used.
# If you need to run mysqld under a different user or group,
# customize your systemd unit file for mariadb according to the
# instructions in http://fedoraproject.org/wiki/Systemd
skip-grant-tables
[mysqld_safe]
log-error=/var/log/mariadb/mariadb.log
pid-file=/var/run/mariadb/mariadb.pid

#
# include all files from the config directory
#
!includedir /etc/my.cnf.d

Restart mysql

# systemctl restart mariadb.service

Reset the mysql password no

# mysql -uadmin -p`cat /etc/psa/.psa.shadow` psa
mysql> UPDATE mysql.user SET Password=PASSWORD('# mysql -uadmin -p`cat /etc/psa/.psa.shadow` psa
mysql> UPDATE mysql.user SET Password=PASSWORD('$AES-128-CBC......') WHERE User='admin';') WHERE User='admin';

Edit my.cnf and remove skip-grant-tables

[mysqld]
local-infile=0
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
# Settings user and group are ignored when systemd is used.
# If you need to run mysqld under a different user or group,
# customize your systemd unit file for mariadb according to the
# instructions in http://fedoraproject.org/wiki/Systemd
# skip-grant-tables
[mysqld_safe]
log-error=/var/log/mariadb/mariadb.log
pid-file=/var/run/mariadb/mariadb.pid

Leave a Comment

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.