阿里云ECS,搭建MySQL5.7数据库环境

为什么80%的码农都做不了架构师?>>>   hot3.png

配置mysql yum源 

[root@iZbp1j6oiamq7t2otpryarZ ~]# cd /data/
[root@iZbp1j6oiamq7t2otpryarZ data]# ll
total 0###################################下载mysql源安装包#
[root@iZbp1j6oiamq7t2otpryarZ data]# wget -P ./ http://dev.mysql.com/get/mysql57-community-release-el7-8.noarch.rpm
--2017-11-02 13:04:56--  http://dev.mysql.com/get/mysql57-community-release-el7-8.noarch.rpm
Resolving dev.mysql.com (dev.mysql.com)... 137.254.60.11
Connecting to dev.mysql.com (dev.mysql.com)|137.254.60.11|:80... connected.
HTTP request sent, awaiting response... 301 Moved Permanently
Location: https://dev.mysql.com/get/mysql57-community-release-el7-8.noarch.rpm [following]
--2017-11-02 13:04:57--  https://dev.mysql.com/get/mysql57-community-release-el7-8.noarch.rpm
Connecting to dev.mysql.com (dev.mysql.com)|137.254.60.11|:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: https://repo.mysql.com//mysql57-community-release-el7-8.noarch.rpm [following]
--2017-11-02 13:04:59--  https://repo.mysql.com//mysql57-community-release-el7-8.noarch.rpm
Resolving repo.mysql.com (repo.mysql.com)... 118.215.180.109
Connecting to repo.mysql.com (repo.mysql.com)|118.215.180.109|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 9116 (8.9K) [application/x-redhat-package-manager]
Saving to: ‘./mysql57-community-release-el7-8.noarch.rpm’100%[===================================================================================================>] 9,116       --.-K/s   in 0s      2017-11-02 13:04:59 (145 MB/s) - ‘./mysql57-community-release-el7-8.noarch.rpm’ saved [9116/9116][root@iZbp1j6oiamq7t2otpryarZ data]# ll
total 12
-rw-r--r-- 1 root root 9116 Apr 11  2016 mysql57-community-release-el7-8.noarch.rpm####################################安装mysql源#
[root@iZbp1j6oiamq7t2otpryarZ data]# yum localinstall mysql57-community-release-el7-8.noarch.rpm
Loaded plugins: fastestmirror
Examining mysql57-community-release-el7-8.noarch.rpm: mysql57-community-release-el7-8.noarch
Marking mysql57-community-release-el7-8.noarch.rpm to be installed
Resolving Dependencies
--> Running transaction check
---> Package mysql57-community-release.noarch 0:el7-8 will be installed
--> Finished Dependency ResolutionDependencies Resolved=============================================================================================================================================Package                                Arch                Version               Repository                                            Size
=============================================================================================================================================
Installing:mysql57-community-release              noarch              el7-8                 /mysql57-community-release-el7-8.noarch              8.2 kTransaction Summary
=============================================================================================================================================
Install  1 PackageTotal size: 8.2 k
Installed size: 8.2 k
Is this ok [y/d/N]: y
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transactionInstalling : mysql57-community-release-el7-8.noarch                                                                                    1/1 Verifying  : mysql57-community-release-el7-8.noarch                                                                                    1/1 Installed:mysql57-community-release.noarch 0:el7-8                                                                                                   Complete!####################################检查mysql源是否安装成功#
[root@iZbp1j6oiamq7t2otpryarZ data]# yum repolist enabled | grep "mysql.*-community.*"
mysql-connectors-community/x86_64 MySQL Connectors Community                  42
mysql-tools-community/x86_64      MySQL Tools Community                       51
mysql57-community/x86_64          MySQL 5.7 Community Server                 227
###########看到上面内容,表示安装成功。####################################
# mysql源配置文件:/etc/yum.repos.d/mysql-community.repo
# 比如要安装5.6版本,可将5.7源的enabled=1改成enabled=0。并将5.6源的enabled=0改成enabled=1即可。
####################################
[root@iZbp1j6oiamq7t2otpryarZ data]# cat /etc/yum.repos.d/mysql-community.repo
[mysql-connectors-community]
name=MySQL Connectors Community
baseurl=http://repo.mysql.com/yum/mysql-connectors-community/el/7/$basearch/
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql[mysql-tools-community]
name=MySQL Tools Community
baseurl=http://repo.mysql.com/yum/mysql-tools-community/el/7/$basearch/
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql# Enable to use MySQL 5.5
[mysql55-community]
name=MySQL 5.5 Community Server
baseurl=http://repo.mysql.com/yum/mysql-5.5-community/el/7/$basearch/
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql# Enable to use MySQL 5.6
[mysql56-community]
name=MySQL 5.6 Community Server
baseurl=http://repo.mysql.com/yum/mysql-5.6-community/el/7/$basearch/
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql[mysql57-community]
name=MySQL 5.7 Community Server
baseurl=http://repo.mysql.com/yum/mysql-5.7-community/el/7/$basearch/
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql[mysql-tools-preview]
name=MySQL Tools Preview
baseurl=http://repo.mysql.com/yum/mysql-tools-preview/el/7/$basearch/
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql[root@iZbp1j6oiamq7t2otpryarZ data]# 

安装mysql:

#################################### 安装MySQL #
[root@iZbp1j6oiamq7t2otpryarZ data]# yum install mysql-community-server
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
Resolving Dependencies
--> Running transaction check
---> Package mysql-community-server.x86_64 0:5.7.20-1.el7 will be installed
--> Processing Dependency: mysql-community-common(x86-64) = 5.7.20-1.el7 for package: mysql-community-server-5.7.20-1.el7.x86_64
--> Processing Dependency: mysql-community-client(x86-64) >= 5.7.9 for package: mysql-community-server-5.7.20-1.el7.x86_64
--> Processing Dependency: libaio.so.1(LIBAIO_0.4)(64bit) for package: mysql-community-server-5.7.20-1.el7.x86_64
--> Processing Dependency: libaio.so.1(LIBAIO_0.1)(64bit) for package: mysql-community-server-5.7.20-1.el7.x86_64
--> Processing Dependency: libaio.so.1()(64bit) for package: mysql-community-server-5.7.20-1.el7.x86_64
--> Running transaction check
---> Package libaio.x86_64 0:0.3.109-13.el7 will be installed
---> Package mysql-community-client.x86_64 0:5.7.20-1.el7 will be installed
--> Processing Dependency: mysql-community-libs(x86-64) >= 5.7.9 for package: mysql-community-client-5.7.20-1.el7.x86_64
---> Package mysql-community-common.x86_64 0:5.7.20-1.el7 will be installed
--> Running transaction check
---> Package mariadb-libs.x86_64 1:5.5.52-1.el7 will be obsoleted
--> Processing Dependency: libmysqlclient.so.18()(64bit) for package: 2:postfix-2.10.1-6.el7.x86_64
--> Processing Dependency: libmysqlclient.so.18(libmysqlclient_18)(64bit) for package: 2:postfix-2.10.1-6.el7.x86_64
---> Package mysql-community-libs.x86_64 0:5.7.20-1.el7 will be obsoleting
--> Running transaction check
---> Package mysql-community-libs-compat.x86_64 0:5.7.20-1.el7 will be obsoleting
--> Finished Dependency ResolutionDependencies Resolved=============================================================================================================================================Package                                     Arch                   Version                          Repository                         Size
=============================================================================================================================================
Installing:mysql-community-libs                        x86_64                 5.7.20-1.el7                     mysql57-community                 2.1 Mreplacing  mariadb-libs.x86_64 1:5.5.52-1.el7mysql-community-libs-compat                 x86_64                 5.7.20-1.el7                     mysql57-community                 2.0 Mreplacing  mariadb-libs.x86_64 1:5.5.52-1.el7mysql-community-server                      x86_64                 5.7.20-1.el7                     mysql57-community                 164 M
Installing for dependencies:libaio                                      x86_64                 0.3.109-13.el7                   base                               24 kmysql-community-client                      x86_64                 5.7.20-1.el7                     mysql57-community                  24 Mmysql-community-common                      x86_64                 5.7.20-1.el7                     mysql57-community                 272 kTransaction Summary
=============================================================================================================================================
Install  3 Packages (+3 Dependent packages)Total download size: 192 M
Is this ok [y/d/N]: y
Downloading packages:
(1/6): libaio-0.3.109-13.el7.x86_64.rpm                                                                               |  24 kB  00:00:00     
warning: /var/cache/yum/x86_64/7/mysql57-community/packages/mysql-community-common-5.7.20-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Public key for mysql-community-common-5.7.20-1.el7.x86_64.rpm is not installed
(2/6): mysql-community-common-5.7.20-1.el7.x86_64.rpm                                                                 | 272 kB  00:00:00     
(3/6): mysql-community-libs-5.7.20-1.el7.x86_64.rpm                                                                   | 2.1 MB  00:00:00     
(4/6): mysql-community-libs-compat-5.7.20-1.el7.x86_64.rpm                                                            | 2.0 MB  00:00:00     
(5/6): mysql-community-client-5.7.20-1.el7.x86_64.rpm                                                                 |  24 MB  00:00:08     
(6/6): mysql-community-server-5.7.20-1.el7.x86_64.rpm                                                                 | 164 MB  00:01:10     
---------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                        2.6 MB/s | 192 MB  00:01:13     
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
Importing GPG key 0x5072E1F5:Userid     : "MySQL Release Engineering <mysql-build@oss.oracle.com>"Fingerprint: a4a9 4068 76fc bd3c 4567 70c8 8c71 8d3b 5072 e1f5Package    : mysql57-community-release-el7-8.noarch (installed)From       : /etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
Is this ok [y/N]: y
Running transaction check
Running transaction test
Transaction test succeeded
Running transactionInstalling : mysql-community-common-5.7.20-1.el7.x86_64                                                                                1/7 Installing : mysql-community-libs-5.7.20-1.el7.x86_64                                                                                  2/7 Installing : mysql-community-client-5.7.20-1.el7.x86_64                                                                                3/7 Installing : libaio-0.3.109-13.el7.x86_64                                                                                              4/7 Installing : mysql-community-server-5.7.20-1.el7.x86_64                                                                                5/7 Installing : mysql-community-libs-compat-5.7.20-1.el7.x86_64                                                                           6/7 Erasing    : 1:mariadb-libs-5.5.52-1.el7.x86_64                                                                                        7/7 Verifying  : mysql-community-libs-5.7.20-1.el7.x86_64                                                                                  1/7 Verifying  : mysql-community-server-5.7.20-1.el7.x86_64                                                                                2/7 Verifying  : mysql-community-common-5.7.20-1.el7.x86_64                                                                                3/7 Verifying  : mysql-community-client-5.7.20-1.el7.x86_64                                                                                4/7 Verifying  : mysql-community-libs-compat-5.7.20-1.el7.x86_64                                                                           5/7 Verifying  : libaio-0.3.109-13.el7.x86_64                                                                                              6/7 Verifying  : 1:mariadb-libs-5.5.52-1.el7.x86_64                                                                                        7/7 Installed:mysql-community-libs.x86_64 0:5.7.20-1.el7 mysql-community-libs-compat.x86_64 0:5.7.20-1.el7 mysql-community-server.x86_64 0:5.7.20-1.el7Dependency Installed:libaio.x86_64 0:0.3.109-13.el7       mysql-community-client.x86_64 0:5.7.20-1.el7       mysql-community-common.x86_64 0:5.7.20-1.el7      Replaced:mariadb-libs.x86_64 1:5.5.52-1.el7                                                                                                         Complete!

启动mysql服务

[root@iZbp1j6oiamq7t2otpryarZ data]# systemctl start mysqld
[root@iZbp1j6oiamq7t2otpryarZ data]# systemctl status mysqld
● mysqld.service - MySQL ServerLoaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled)Active: active (running) since Thu 2017-11-02 13:23:48 CST; 18s agoDocs: man:mysqld(8)http://dev.mysql.com/doc/refman/en/using-systemd.htmlProcess: 23892 ExecStart=/usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pid $MYSQLD_OPTS (code=exited, status=0/SUCCESS)Process: 23818 ExecStartPre=/usr/bin/mysqld_pre_systemd (code=exited, status=0/SUCCESS)Main PID: 23895 (mysqld)CGroup: /system.slice/mysqld.service└─23895 /usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pidNov 02 13:23:42 iZbp1j6oiamq7t2otpryarZ systemd[1]: Starting MySQL Server...
Nov 02 13:23:48 iZbp1j6oiamq7t2otpryarZ systemd[1]: Started MySQL Server.

开机启动

[root@iZbp1j6oiamq7t2otpryarZ data]# systemctl enable mysqld
[root@iZbp1j6oiamq7t2otpryarZ data]# systemctl daemon-reload

停止mysql服务

[root@iZbp1j6oiamq7t2otpryarZ data]# systemctl stop mysqld
[root@iZbp1j6oiamq7t2otpryarZ data]# systemctl status mysqld
● mysqld.service - MySQL ServerLoaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled)Active: inactive (dead) since Thu 2017-11-02 13:31:35 CST; 5s agoDocs: man:mysqld(8)http://dev.mysql.com/doc/refman/en/using-systemd.htmlMain PID: 23895 (code=exited, status=0/SUCCESS)Nov 02 13:23:42 iZbp1j6oiamq7t2otpryarZ systemd[1]: Starting MySQL Server...
Nov 02 13:23:48 iZbp1j6oiamq7t2otpryarZ systemd[1]: Started MySQL Server.
Nov 02 13:31:33 iZbp1j6oiamq7t2otpryarZ systemd[1]: Stopping MySQL Server...
Nov 02 13:31:35 iZbp1j6oiamq7t2otpryarZ systemd[1]: Stopped MySQL Server.
[root@iZbp1j6oiamq7t2otpryarZ data]# 

更改数据文件位置:

将/var/lib下的mysql目录,mv(移动)到/data目录下:

为什么要用mv命令,而不用cp命令呢?应为linux文件系统特殊性,mv命令能保留文件的所有属性和权限,尤其是selinux属性。如果用cp命令,就需要回头再去设置mysql文件夹的selinux属性,本人因很头疼selinux故能避则避。

[root@iZbp1j6oiamq7t2otpryarZ data]# mv /var/lib/mysql /data/mysql
[root@iZbp1j6oiamq7t2otpryarZ data]# ll
total 12
drwxr-x--x 5 mysql mysql  314 Nov  2 13:31 mysql
-rw-r--r-- 1 root  root  9116 Apr 11  2016 mysql57-community-release-el7-8.noarch.rpm
[root@iZbp1j6oiamq7t2otpryarZ data]# 

修改mysql配置文件/etc/my.cnf。将datadir和socket的路径改为/data目录下:

[root@iZbp1j6oiamq7t2otpryarZ data]# cat /etc/my.cnf
# For advice on how to change settings please see
# http://dev.mysql.com/doc/refman/5.7/en/server-configuration-defaults.html[mysqld]
#
# Remove leading # and set to the amount of RAM for the most important data
# cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.
# innodb_buffer_pool_size = 128M
#
# Remove leading # to turn on a very important data integrity option: logging
# changes to the binary log between backups.
# log_bin
#
# Remove leading # to set options mainly useful for reporting servers.
# The server defaults are faster for transactions and fast SELECTs.
# Adjust sizes as needed, experiment to find the optimal values.
# join_buffer_size = 128M
# sort_buffer_size = 2M
# read_rnd_buffer_size = 2M
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
[root@iZbp1j6oiamq7t2otpryarZ data]# vi /etc/my.cnf
[root@iZbp1j6oiamq7t2otpryarZ data]# cat /etc/my.cnf
# For advice on how to change settings please see
# http://dev.mysql.com/doc/refman/5.7/en/server-configuration-defaults.html[mysqld]
#
# Remove leading # and set to the amount of RAM for the most important data
# cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.
# innodb_buffer_pool_size = 128M
#
# Remove leading # to turn on a very important data integrity option: logging
# changes to the binary log between backups.
# log_bin
#
# Remove leading # to set options mainly useful for reporting servers.
# The server defaults are faster for transactions and fast SELECTs.
# Adjust sizes as needed, experiment to find the optimal values.
# join_buffer_size = 128M
# sort_buffer_size = 2M
# read_rnd_buffer_size = 2M
datadir=/data/mysql
socket=/data/mysql/mysql.sock[mysqld_safe]
socket=/data/mysql/mysql.sock
[client]
socket=/data/mysql/mysql.sock
[mysql.server]
socket=/data/mysql/mysql.sock# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid[root@iZbp1j6oiamq7t2otpryarZ data]# 

然后重新启动mysql服务 :

[root@iZbp1j6oiamq7t2otpryarZ data]# systemctl restart mysqld
[root@iZbp1j6oiamq7t2otpryarZ data]# systemctl status mysqld
● mysqld.service - MySQL ServerLoaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled)Active: active (running) since Thu 2017-11-02 13:40:54 CST; 5s agoDocs: man:mysqld(8)http://dev.mysql.com/doc/refman/en/using-systemd.htmlProcess: 24037 ExecStart=/usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pid $MYSQLD_OPTS (code=exited, status=0/SUCCESS)Process: 24019 ExecStartPre=/usr/bin/mysqld_pre_systemd (code=exited, status=0/SUCCESS)Main PID: 24040 (mysqld)CGroup: /system.slice/mysqld.service└─24040 /usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pidNov 02 13:40:53 iZbp1j6oiamq7t2otpryarZ systemd[1]: Starting MySQL Server...
Nov 02 13:40:54 iZbp1j6oiamq7t2otpryarZ systemd[1]: Started MySQL Server.
[root@iZbp1j6oiamq7t2otpryarZ data]# 

修改root本地登录密码

mysql安装完成之后,在/var/log/mysqld.log文件中给root生成了一个默认密码。通过下面的方式找到root默认密码,然后登录mysql进行修改:

[root@iZbp1j6oiamq7t2otpryarZ data]# grep 'temporary password' /var/log/mysqld.log
2017-11-02T05:23:44.524190Z 1 [Note] A temporary password is generated for root@localhost: MyOldPass123!
[root@iZbp1j6oiamq7t2otpryarZ data]# 
[root@iZbp1j6oiamq7t2otpryarZ data]# mysql -uroot -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.7.20Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.mysql>  
mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'MyNewPass123!'; 

或者

mysql> set password for 'root'@'localhost'=password('MyNewPass123!');

注意:
mysql5.7默认安装了密码安全检查插件(validate_password),默认密码检查策略要求密码必须包含:大小写字母、数字和特殊符号,并且长度不能少于8位,否则会提示:

mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'gq123!mysql';
ERROR 1819 (HY000): Your password does not satisfy the current policy requirements

 通过msyql环境变量可以查看密码策略的相关信息:

mysql> show variables like '%password%';
+---------------------------------------+--------+
| Variable_name                         | Value  |
+---------------------------------------+--------+
| default_password_lifetime             | 0      |
| disconnect_on_expired_password        | ON     |
| log_builtin_as_identified_by_password | OFF    |
| mysql_native_password_proxy_users     | OFF    |
| old_passwords                         | 0      |
| report_password                       |        |
| sha256_password_proxy_users           | OFF    |
| validate_password_check_user_name     | OFF    |
| validate_password_dictionary_file     |        |
| validate_password_length              | 8      |
| validate_password_mixed_case_count    | 1      |
| validate_password_number_count        | 1      |
| validate_password_policy              | MEDIUM |
| validate_password_special_char_count  | 1      |
+---------------------------------------+--------+
14 rows in set (0.00 sec)mysql> 

validate_password_policy:密码策略,默认为MEDIUM策略 
validate_password_dictionary_file:密码策略文件,策略为STRONG才需要 
validate_password_length:密码最少长度 
validate_password_mixed_case_count:大小写字符长度,至少1个 
validate_password_number_count :数字至少1个 
validate_password_special_char_count:特殊字符至少1个 
上述参数是默认策略MEDIUM的密码检查规则。

共有以下几种密码策略:

策略检查规则
0 or LOWLength
1 or MEDIUMLength; numeric, lowercase/uppercase, and special characters
2 or STRONGLength; numeric, lowercase/uppercase, and special characters; dictionary file

MySQL官网密码策略详细说明:
http://dev.mysql.com/doc/refman/5.7/en/validate-password-options-variables.html#sysvar_validate_password_policy

修改密码策略

在/etc/my.cnf文件添加validate_password_policy配置,指定密码策略

# 选择0(LOW),1(MEDIUM),2(STRONG)其中一种,选择2需要提供密码字典文件
validate_password_policy=0

如果不需要密码策略,添加my.cnf文件中添加如下配置禁用即可:

validate_password = off

重新启动mysql服务使配置生效:

systemctl restart mysqld

添加远程登录用户

默认只允许root帐户在本地登录,如果要在其它机器上连接mysql,必须修改root允许远程连接,或者添加一个允许远程连接的帐户,为了安全起见,我添加一个新的帐户:

mysql> GRANT ALL PRIVILEGES ON *.* TO 'yuanchengyonghu'@'%' IDENTIFIED BY 'MyNewPass123' WITH GRANT OPTION;

配置默认编码为utf8

修改/etc/my.cnf配置文件,在[mysqld]下添加编码配置,如下所示:

#在[mysqld]下添加如下内容#
character_set_server=utf8
init_connect='SET NAMES utf8'

设置mysql大小不敏感

lower_case_table_names=1

设置最大连接数及超时时间

max_connections=1000
#max_user_connections=500
wait_timeout=2880

重新启动mysql服务,查看数据库默认编码如下:

[root@iZbp1j6oiamq7t2otpryarZ data]# mysql -uroot -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 5
Server version: 5.7.20 MySQL Community Server (GPL)Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.mysql> show variables like '%character%';
+--------------------------+----------------------------+
| Variable_name            | Value                      |
+--------------------------+----------------------------+
| character_set_client     | utf8                       |
| character_set_connection | utf8                       |
| character_set_database   | utf8                       |
| character_set_filesystem | binary                     |
| character_set_results    | utf8                       |
| character_set_server     | utf8                       |
| character_set_system     | utf8                       |
| character_sets_dir       | /usr/share/mysql/charsets/ |
+--------------------------+----------------------------+
8 rows in set (0.01 sec)mysql> 

默认配置文件路径: 

配置文件:/etc/my.cnf 
日志文件:/var/log/var/log/mysqld.log 
服务启动脚本:/usr/lib/systemd/system/mysqld.service 
socket文件:/var/run/mysqld/mysqld.pid

 

转载于:https://my.oschina.net/90888/blog/1559799

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/287155.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

《看聊天记录都学不会Python到游戏实战?太菜了吧》(9)集万家之长不死 python

本系列文章将会以通俗易懂的对话方式进行教学&#xff0c;对话中将涵盖了新手在学习中的一般问题。此系列将会持续更新&#xff0c;包括别的语言以及实战都将使用对话的方式进行教学&#xff0c;基础编程语言教学适用于零基础小白&#xff0c;之后实战课程也将会逐步更新。 若…

【重磅】ArcGIS 10.8手把手经典图文安装教程(附安装包全套装下载,亲测可用)

ArcMap时代的最后一版软件,未来官方对ArcMap的支持将仅限于提供补丁,更新和新环境支持,换句话说ArcMap10.8.X将会是最终版本,以后不会再有ArcMap10.9了,官方建议所有人在完成工作流程后立即迁移到ArcGIS Pro。 时间真快,ArcGIS 10.7刚装完没几天,作为GISer的我,有的开始…

聊聊 C# 中的 Visitor 模式

前言 Visitor模式在日常工作中出场比较少&#xff0c;如果统计大家不熟悉的模式&#xff0c;那么它榜上有名的可能性非常大。使用频率少&#xff0c;再加上很多文章提到Visitor模式都着重于它克服语言单分派的特点上面&#xff0c;而对何时应该使用这个模式及这个模式是怎么一…

AcWing 889. 满足条件的01序列(卡特兰数应用)

满足条件的01序列 假设长度为n个序列要求满足题意1的前缀0的个数不能超过1的个数 将问题抽象为从(0, 0)到(n, n) 向上走一个代表这一步对应序列中的值是1&#xff0c;向右走代表序列中的值是0 要想满足1的前缀0的数量大于1的数量就需要满足所有路过的途径在y x这个函数个下面…

添加ASP.NET网站资源文件夹

ASP.NET应用程序包含7个默认文件夹&#xff0c;分别为Bin、APP_Code、App_GlobalResources、App_LocalResources、App_WebReferences、App_Browsers和“主题”文件夹。每个文件夹都存放ASP.NET应用程序的不同类型的资源。 方法 说明Bin  包含程序所需的所有已编译程序集&#…

《看聊天记录都学不会Python到游戏实战?太菜了吧》(8)我们开始做一个数字小游戏吧

本系列文章将会以通俗易懂的对话方式进行教学&#xff0c;对话中将涵盖了新手在学习中的一般问题。此系列将会持续更新&#xff0c;包括别的语言以及实战都将使用对话的方式进行教学&#xff0c;基础编程语言教学适用于零基础小白&#xff0c;之后实战课程也将会逐步更新。 若…

Microsoft SQL Server 2019开发版安装配置教程

一、安装cn_sql_server_2019_developer_x64 双击setup.exe进行安转。 点击【安装】。 点击【全新SQL Server独立按住啊或向现有安装添加功能】。 点击【下一步】。

《看聊天记录都学不会C#?太菜了吧》(4)C# 中的尚方宝剑 “先斩后奏”

本系列文章将会以通俗易懂的对话方式进行教学&#xff0c;对话中将涵盖了新手在学习中的一般问题。此系列将会持续更新&#xff0c;包括别的语言以及实战都将使用对话的方式进行教学&#xff0c;基础编程语言教学适用于零基础小白&#xff0c;之后实战课程也将会逐步更新。 若…

如何用 Swift 语言构建一个自定控件

本文译自&#xff1a;How To Make a Custom Control in Swift 用户界面控件是所有应用程序重要的组成部分之一。它们以图形组件的方式呈现给用户&#xff0c;用户可以通过它们与应用程序进行交互。苹果提供了一套控件&#xff0c;例如 UITextField&#xff0c;UIButton&#xf…

《看聊天记录都学不会C#?太菜了吧》(5)C# 中可以用中文名变量?

本系列文章将会以通俗易懂的对话方式进行教学&#xff0c;对话中将涵盖了新手在学习中的一般问题。此系列将会持续更新&#xff0c;包括别的语言以及实战都将使用对话的方式进行教学&#xff0c;基础编程语言教学适用于零基础小白&#xff0c;之后实战课程也将会逐步更新。 若…

【ArcGIS遇上Python】ArcGIS Python中文编码问题案例详解

前面的文章《ArcGIS Python获取Shapefile矢量数据字段名称》我们已经学会了如何用 Python 获取中文路径下的shp数据的所有字段,英文没有问题,但是如果你输出中文路径下的数据字段, 就有可能会碰到中文编码问题。 Python 文件中如果未指定编码,在执行过程会出现报错: impo…

gRPC编码初探(java)

背景&#xff1a;gRPC是一个高性能、通用的开源RPC框架&#xff0c;其由Google主要面向移动应用开发并基于HTTP/2协议标准而设计&#xff0c;基于ProtoBuf(Protocol Buffers)序列化协议开发&#xff0c;且支持众多开发语言。gRPC提供了一种简单的方法来精确地定义服务和为iOS、…

WPF 基础控件之 RadioButton 样式

其他基础控件1.Window2.Button3.CheckBox4.ComboBox5.DataGrid 6.DatePicker7.Expander8.GroupBox9.ListBox10.ListView11.Menu12.PasswordBox13.TextBox14.ProgressBarRadioButton 实现下面的效果1&#xff09;RadioButton来实现动画&#xff1b;Border嵌套 Ellipse并设置Sca…

《看聊天记录都学不会C#?太菜了吧》(6)多晦涩的专业术语原来都会那么简单

本系列文章将会以通俗易懂的对话方式进行教学&#xff0c;对话中将涵盖了新手在学习中的一般问题。此系列将会持续更新&#xff0c;包括别的语言以及实战都将使用对话的方式进行教学&#xff0c;基础编程语言教学适用于零基础小白&#xff0c;之后实战课程也将会逐步更新。 若…

SQLServer2008-镜像数据库实施手册(双机)SQL-Server2014同样适用

SQL Server2008R2-镜像数据库实施手册(双机)SQL Server2014同样适用 一、配置主备机 1、 服务器基本信息 主机名称为&#xff1a;HOST_A&#xff0c;IP地址为&#xff1a;192.168.1.155 备机名称为&#xff1a;HOST_B&#xff0c;IP地址为&#xff1a;192.168.1.156 二、主备实…

一万字一篇文20分钟学会C语言和Python,十四年编程经验老鸟传授经验之道

前言 昨天在直播中有粉丝问我如何快速的对编程语言入门&#xff0c;我想这个问题是有必要让大家知道的&#xff0c;相必也有很多新手对于如何快速完成编程语言的入门学习很感兴趣&#xff0c;本篇文将会使用 C 语言以及 Python 为例&#xff0c;做出对比&#xff0c;让大家对编…

【Python可视化】Windows 10系统上Pyecharts安装教程

简单的Python库&#xff0c;如Numpy&#xff0c;可以直接在PyCharm中自动下载并安装。 同添加Python环境变量一样&#xff0c;需要先添加pip环境变量。pip位于C:\Python27\ArcGIS10.8\Scripts路径下。 WinR→cmd&#xff1a; 安装完成&#xff01;

使用.Net分析.Net达人挑战赛参与情况

背景C#是我2012年在大学课程中接触的&#xff0c;.NET Framework 我也一直使用至今。从2014年.NET 开源&#xff0c;2019年发布.NET Core 3 的时候&#xff0c;公司刚好有 Nvidia Jetson 平台 Linux 嵌入式设备的开发任务&#xff0c;.NET 又刚是适用于 Windows, Linux, 和 mac…

十分钟如何学会C语言?掌握规律举一反三考试提50分!

前言 上周写了一篇 20 分钟学会 C 语言与Python的文章——《一万字一篇文20分钟学会C语言和Python&#xff0c;十四年编程经验老鸟传授经验之道》&#xff0c;之后见粉丝转了一个话题“十分钟如何学会C语言”&#xff0c;我就在想是否能够十分钟呢&#xff1f;答案是可以的&am…

c语言在win8系统不兼容,Win8系统中存在不兼容软件如何解决?

最近有刚升级Win8系统的用户反映&#xff0c;FastStone Capture截图软件在Win7系统中可以兼容&#xff0c;正常打开&#xff0c;可是在Win8系统中就不能兼容了&#xff0c;这让用户非常烦恼。那么&#xff0c;Win8系统中存在不兼容软件如何解决呢&#xff1f;下面&#xff0c;我…