Optimizations after installing the MySQL database (removing redundant users and databases)

Source: Internet
Author: User
Tags saltstack

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)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.