标签归档:Mysql

MySQL的安装与配置

本来是在学习PostgreSQL,想安装个mySQL 5.7 做一些实践比较,但发现 mysql5.7在centos 7.2上,使用 YUM 怎么也安装不上。刚开始是和MariaDB冲突(centos7.2默认自带mariaDB),使用

rpm -e --nodeps mariadb-libs-5.5.44-2.el7.centos.x86_64

强制卸载后,紧接又提示:

2:postfix-2.10.1-6.el7.x86_64 有缺少的需求 libmysqlclient.so.18()(64bit)
2:postfix-2.10.1-6.el7.x86_64 有缺少的需求 libmysqlclient.so.18(libmysqlclient_18)(64bit)

无奈之下,才写了这一篇安装mysql5.7的笔记。

继续阅读

MySQL性能优化之show variables(三)

一、variables预览

# mysql -u root -p
mysql> show variables;
+-----------------------------------------+--------------------------+
| Variable_name                           | Value                    |
+-----------------------------------------+--------------------------+
| auto_increment_increment                | 1                        |
| auto_increment_offset                   | 1                        |
| autocommit                              | ON                       |
| automatic_sp_privileges                 | ON                       |
| back_log                                | 50                       |
| basedir                                 | /usr/                    |
| big_tables                              | OFF                      |
| binlog_cache_size                       | 32768                    |
| binlog_direct_non_transactional_updates | OFF                      |
 继续阅读 

MySQL性能优化之show status(二)

一、status预览

# mysql -u root -p
mysql> show status;
+-----------------------------------+----------+
| Variable_name                     | Value    |
+-----------------------------------+----------+
| Aborted_clients                   | 2        |
| Aborted_connects                  | 3        |
| Binlog_cache_disk_use             | 0        |
| Binlog_cache_use                  | 0        |
| Bytes_received                    | 1197     |
| Bytes_sent                        | 76191    |
| Com_admin_commands                | 0        |
| Com_assign_to_keycache            | 0        |
| Com_alter_db                      | 0        |
| Com_alter_db_upgrade              | 0        |
 继续阅读 

MySQL性能优化之show processlist(一)

一、processlist预览

# mysql -u root -p
mysql> show processlist;
+-----+--------+-----------+--------+---------+------+-------+------------------+
| Id | User    | Host      | db      | Command | Time | State | Info |
+-----+--------+-----------+--------+---------+------+-------+------------------+
| 14  | taisha | localhost | sns     | Sleep   | 19   |       | NULL |
| 19  | taisha | localhost | sns     | Sleep   | 47   |       | NULL |
| 83  | discuz | localhost | discuz  | Sleep   | 2758 |       | NULL |
| 91  | discuz | localhost | discuz  | Sleep   | 2677 |       | NULL |
| 93  | discuz | localhost | discuz  | Sleep   | 2673 |       | NULL |
| 94  | discuz | localhost | discuz  | Sleep   | 2675 |       | NULL |
| 95  | discuz | localhost | discuz  | Sleep   | 2755 |       | NULL |
| 96  | discuz | localhost | discuz  | Sleep   | 2729 |       | NULL |
| 188 | taisha | localhost | sns     | Sleep   | 76   |       | NULL |
| 190 | root   | localhost | NULL    | Query   | 0    | NULL  | show processlist |
+-----+--------+-----------+--------+---------+------+-------+------------------+

继续阅读

MySQL的配置方法

一、配置的三种方法
  • 方法1:修改/etc/my.cnf配置文件,重启MySQL后,设置生效。
  • 方法2:采用set GLOBAL方式,直接生效,重启MySQL后,设置失效。
  • 方法3:启动MySQL时,添加参数的方式(不推荐)。

继续阅读