1. Start mariadb
Systemctl Start mariadb
2. Set Boot mariadb
Systemctl Enable MARIADB
First, change the user password, take root as an example
1. Know the root password, need to modify
Method A. Log into the database to modify
- # mysql-uroot-p/* Enter password to enter */
- /* First way: Edit database Fields directly */
- MariaDB [(none)]> use MySQL;
- MariaDB [mysql]> UPDATE user SET Password=password (' newpassword ') WHERE user= ' root ';
- MariaDB [mysql]> flush Privileges;
- MariaDB [mysql]> exit
- /* Second way: Change the password without entering mysql*/
- MariaDB [(none)]> SET password for ' root ' @ ' localhost ' =password (' newpassword ');
- MariaDB [(none)]> exit;
Method B. Using Mysqladmin
- /* This is not a good thing to do is that the password is displayed in the command line to clear text */
- # mysqladmin-uroot-poldpassword Password newpassword/* or */
- # mysqladmin-uroot-p Password NewPassword
2. Forgot root password, need to reset
- # Systemctl Stop MARIADB/* First stop the current MySQL process, or do the next step that the process already exists */
- # mysqld_safe--skip-grant-tables & * * Background directly this MySQL, the interface will also appear in the log, direct CTRL + C into the command line input */
- # Ps-ef | grep mariadb/* See the process, highlighting--skip-grant-tables*/
- MySQL 3607 3368 0 18:05 pts/0 00:00:00/usr/libexec/mysqld--basedir=/usr--datadir=/var/lib/mysql
- --plugin-dir=/usr/lib64/mysql/plugin--user=mysql--skip-grant-tables--log-error=/var/log/mariadb/mariadb.log
- --pid-file=/var/run/mariadb/mariadb.pid--socket=/var/lib/mysql/mysql.sock
- # mysql/* directly into MySQL, do not need a password, etc., do the first step in method A in either of the two ways can */
- MariaDB [(none)]> use MySQL;
- MariaDB [mysql]> UPDATE user SET Password=password (' newpassword ') WHERE user= ' root ';
- MariaDB [mysql]> flush Privileges;
- MariaDB [mysql]> exit; /* This time with the parameter--skip-grant-tables started MySQL will be required to enter the password to enter the * *
- # pkill MySQL/* Use Pkill to kill, kill, kill automatically after killing a */
- # Systemctl Start mariadb/* Starts the normal mysql*/
Second, change the MySQL parameters, take max_allowed_packet as an example
Method 1. Editing a configuration file
# VIM/ETC/MY.CNF
- max_allowed_packet=20m/* Maximum number of connections */
- Max_connections = 500
# systemctl Restart MARIADB/* Restart effective */
Method 2. Log in to the database to set, but the restart will be restored, it is recommended to directly use the above method of changing the configuration file
MariaDB [(None)]> show variables like ' Max_allowed_packet ';
- +--------------------+---------+
- | variable_name | Value |
- +--------------------+---------+
- | Max_allowed_packet | 1048576 |
- +--------------------+---------+
- 1 row in Set (0.00 sec)
MariaDB [(None)]> set global max_allowed_packet = 2*1024*1024*10; /* Adjust the query maximum run package size from the default 1M to 20m*/
MYSQL/MARIADB Database Configuration