1. View the version information of the database:
MariaDB [(None)]> select version (); +----------------+| Version () |+----------------+| 5.5.52-MARIADB |+----------------+1 row in Set (0.18 sec)
2. Delete extra accounts (except root and localhost)
mariadb [(None)]> use mysqlmariadb [mysql]> select user,host from mysql.user;+------+------------------------+| user | host |+------+----------------- -------+| root | 127.0.0.1 | | root | ::1 | | | localhost | | root | localhost | | | lvs-dr01.saltstack.com | | root | lvs-dr01.saltstack.com |+------+------------------------+6 rows in set (0.03 sec) mariadb [mysql]> delete from mysql.user where (user,host) not in (select ' root ', ' localhost '); query ok, 5 rows affected (0.05 sec) mariadb [mysql]> select user,host from mysql.user;+------+-----------+| user | host |+------+-----------+| root | localhost |+------+-----------+1 row in set (0.05 SEC)
3 . Modify mysql default MySQL admin account
Modify the default MySQL Admin account (root changes to MySQL and set the new password to redhat12345)
MariaDB [mysql]> Update mysql.user set user= ' admin ', Password=password (' redhat12345 '); Query OK, 1 row affected (0.08 sec) Rows matched:1 changed:1 warnings:0mariadb [mysql]> flush privileges; Query OK, 0 rows affected (0.03 sec) [[email protected] ~]# mysql-uadmin-p ' redhat12345 ' MariaDB [(none)]> user Mysql;ma RIADB [mysql]> Show tables;
To continue the query:
MariaDB [mysql]> Select User,host from mysql.user;+-------+-----------+| user | Host |+-------+-----------+| admin | localhost |+-------+-----------+1 row in Set (0.00 sec)
4. Delete Test database:
MariaDB [mysql]> drop Database test; MariaDB [mysql]> flush Privileges; MariaDB [(None)]> show databases;+--------------------+| Database |+--------------------+| Information_schema | | MySQL | | Performance_schema |+--------------------+3 rows in Set (0.06 sec)
To this, the basic optimization after installation is complete
This article is from the "Frozen vs watermelon" blog, so be sure to keep this source http://molewan.blog.51cto.com/287340/1940496
Optimizations after installing the MySQL database (removing redundant users and databases)