MySQL初始化简单优化

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了MySQL初始化简单优化相关的知识,希望对你有一定的参考价值。

1,yum  2,源码 3,二进制 4,源码+yum

不管哪种方式装完成数据库,都需要对数据库做一些优化.

 

技术分享
优化数据库

mysql> select host,user from mysql.user;
+-----------+------+
| host      | user |
+-----------+------+
| 127.0.0.1 | root |
| ::1       | root |
| localhost |      |
| localhost | root |
| www       |      |
| www       | root |
+-----------+------+
6 rows in set (0.00 sec)
#删掉用户名为null的
mysql> delete from mysql.user where user=‘‘;
Query OK, 2 rows affected (0.00 sec)

mysql> select host,user from mysql.user;
+-----------+------+
| host      | user |
+-----------+------+
| 127.0.0.1 | root |
| ::1       | root |
| localhost | root |
| www       | root |
+-----------+------+
4 rows in set (0.00 sec)

drop user ‘‘@localhost;
drop user ‘‘@::1;
drop user root@lanny;
drop user ‘‘@lanny;
mysql> select user,host from mysql.user;

mysql>
#有时候drop删不掉(可能包含特殊字符),才会用delete命令
删掉ipv6的:
mysql> delete from mysql.user where host=::1;
Query OK, 1 row affected (0.00 sec)

mysql> select user,host from mysql.user;
+------+-----------+
| user | host      |
+------+-----------+
| root | 127.0.0.1 |
| root | localhost |
| root | www       |
+------+-----------+
3 rows in set (0.00 sec)
删掉www的
mysql> delete from mysql.user where host=www;
Query OK, 1 row affected (0.00 sec)

mysql> select user,host from mysql.user;
+------+-----------+
| user | host      |
+------+-----------+
| root | 127.0.0.1 |
| root | localhost |
+------+-----------+
2 rows in set (0.00 sec)

mysql>
删掉test库
mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| test               |
+--------------------+
4 rows in set (0.00 sec)

mysql> drop database test;
Query OK, 0 rows affected (0.00 sec)

mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
+--------------------+
3 rows in set (0.00 sec)
View Code

 

以上是关于MySQL初始化简单优化的主要内容,如果未能解决你的问题,请参考以下文章

如何在片段着色器中平铺部分纹理

优化 C# 代码片段、ObservableCollection 和 AddRange

使用 C++ 反转句子中的每个单词需要对我的代码片段进行代码优化

如何优化C ++代码的以下片段 - 卷中的零交叉

php mysql 一个查询优化的简单例子

从JVM的角度看JAVA代码--代码优化