Verificando versão
1 2 |
[root@srvweb ~]# mysql --version mysql Ver 15.1 Distrib 5.5.60-MariaDB, for Linux (x86_64) using readline 5.1 |
Verificando processos em execução
1 2 3 4 |
[root@srvweb ~]# ps -ef |grep mysql root 2102 3048 0 17:14 pts/0 00:00:00 grep --color=auto mysql mysql 3683 1 0 Oct12 ? 00:00:00 /bin/sh /usr/bin/mysqld_safe --basedir=/usr mysql 3894 3683 0 Oct12 ? 07:39:57 /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 |
Parando Mysql / MariaDB
1 |
[root@srvweb ~]# systemctl stop mariadb |
Resetando o password
1 2 3 4 |
[root@srvweb ~]# mysqld_safe --skip-grant-tables --skip-networking & [1] 3190 [root@srvweb ~]# 191202 17:14:45 mysqld_safe Logging to '/var/log/mariadb/mariadb.log'. 191202 17:14:45 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql |
Logando Mysql / MariaDB
1 2 3 4 5 6 7 8 |
[root@srvweb ~]# mysql -u root Welcome to the MariaDB monitor. Commands end with ; or \g. Your MariaDB connection id is 2 Server version: 5.5.60-MariaDB MariaDB Server Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. |
1 2 |
MariaDB [(none)]> FLUSH PRIVILEGES; Query OK, 0 rows affected (0.02 sec) |
1 2 |
MariaDB [(none)]> SET PASSWORD FOR 'root'@'localhost' = PASSWORD('PASSWORD'); Query OK, 0 rows affected (0.00 sec) |
1 2 3 |
MariaDB [(none)]> UPDATE mysql.user SET authentication_string = PASSWORD('PASSWORD') WHERE User = 'root' AND Host = 'localhost'; Query OK, 1 row affected (0.00 sec) Rows matched: 1 Changed: 1 Warnings: 0 |
Necessário parar o MariaDB para desativar o mysqld_safe
1 2 3 |
MariaDB [(none)]> CREATE USER 'teste'@'localhost' IDENTIFIED BY 'password'; ERROR 1290 (HY000): The MariaDB server is running with the --skip-grant-tables option so it cannot execute this statement |
Pare o Mysql / MariaDB com o mysqladmin
1 2 |
[root@srvweb ~]# mysqladmin shutdown [1]+ Done mysqld_safe --skip-grant-tables --skip-networking |
Pare e inicie o MariaDB
1 2 3 |
systemctl start mariadb systemctl start mysql |
…