阿里云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.pswp.cn/news/287155.shtml
繁體地址,請注明出處:http://hk.pswp.cn/news/287155.shtml
英文地址,請注明出處:http://en.pswp.cn/news/287155.shtml

如若內容造成侵權/違法違規/事實不符,請聯系多彩編程網進行投訴反饋email:809451989@qq.com,一經查實,立即刪除!

相關文章

Python——通過斐波那契數列來理解生成器

一、生成器&#xff08;generator&#xff09; 先來看看一個簡單的菲波那切數列&#xff0c;出第一個和第二個外&#xff0c;任意一個數都是由前兩個數相加得到的。如&#xff1a;0,1,1,2,3,5,8,13...... 輸入斐波那契數列前N個數&#xff1a; def fab(max): n, a, b 0, 0, 1 …

《看聊天記錄都學不會Python到游戲實戰?太菜了吧》(9)集萬家之長不死 python

本系列文章將會以通俗易懂的對話方式進行教學&#xff0c;對話中將涵蓋了新手在學習中的一般問題。此系列將會持續更新&#xff0c;包括別的語言以及實戰都將使用對話的方式進行教學&#xff0c;基礎編程語言教學適用于零基礎小白&#xff0c;之后實戰課程也將會逐步更新。 若…

公司c語言面試題目,c語言面試最必考的十道試題,求職必看!!!

該樓層疑似違規已被系統折疊 隱藏此樓查看此樓6、free()函數問&#xff1a;下面的程序會在用戶輸入’freeze’的時候出問題&#xff0c;而’zebra’則不會&#xff0c;為什么?#include int main(int argc, char *argv[]) {char *ptr (char*)malloc(10);if(NULL ptr){printf(…

Android之解決TabLayout里面每個Tab項的間距和修改指示線的長度(非反射)和修改選中字體大小

1 問題 1)由于TabLayout設置了可滑動Tab參數 app:tabMode="scrollable" 導致每個Tab之間的間距很大,但是UI設計圖里面的字體之間的間距很小,我們改怎么解決? 2)修改TabLayout指示線的長度(非反射) 3)修改選中的字體大小并且加粗 2 解決辦法 問題1解決辦法…

【重磅】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獨立按住啊或向現有安裝添加功能】。 點擊【下一步】。

Git提示Please move or remove them before you switch branches.

1 問題 git checkout V1 提示錯誤如下 error: The following untracked working tree files would be overwritten by checkout:flutter_module/pubspec.lock Please move or remove them before you switch branches. Aborting2 解決辦法 git clean -df ../flutter_module…

c語言創建新指針,如何用c語言創建一個指針

您總是可以將指針強制轉換為整數&#xff0c;即整數大小比系統中使用的字節指針大3位。然后在向左移動3位后移動指針。然后將位信息存儲在最低有效3位上。然后可以用正常算術遞增該整數“位指針”。像這樣的東西&#xff1a;#include #define bitptr long long#define create_b…

請查收最新的 EF Core 7.0 更新

關注我們作者&#xff1a;Jeremy Likness排版&#xff1a;Rani近期.NET 數據團隊宣布了 EF Core 7.0 (EF7)的第四個預覽版。除了bug修復和更大功能的基礎工作外&#xff0c;此預覽版還包括以確保轉換器和比較器由類型映射處理&#xff0c;并支持將轉換器與值生成器一起使用。請…

【CC精品教程】ContextCapture 4.4.12(CC,Smart 3D)簡體中文版安裝教程(附安裝包下載)

ContextCapture 4.4.12簡體中文版是一款功能強大的三維建模軟件,用戶只需使用自己拍攝的普通照片,就能快速創建細節豐富的三維實景模型,并在項目的整個生命周期內為設計、施工和運營決策提供精確的現實環境背景。 目 錄 一、安裝過程 1. 安裝主程序cncpc040412333en_updt1…

《看聊天記錄都學不會C#?太菜了吧》(4)C# 中的尚方寶劍 “先斬后奏”

本系列文章將會以通俗易懂的對話方式進行教學&#xff0c;對話中將涵蓋了新手在學習中的一般問題。此系列將會持續更新&#xff0c;包括別的語言以及實戰都將使用對話的方式進行教學&#xff0c;基礎編程語言教學適用于零基礎小白&#xff0c;之后實戰課程也將會逐步更新。 若…

Android之解決多語言適配部分TextView內容左對齊和內容一行不排滿就到第二行問題

1 問題 1、多語言適配部分TextView內容左對齊 2、內容一行不排滿就到第二行問題 2 解決辦法 問題1、在TextView里面加入下面參數 android:gravity="center" 問題2、 import android.content.Context; import android.graphics.Paint; import android.text.TextUti…

如何用 Swift 語言構建一個自定控件

本文譯自&#xff1a;How To Make a Custom Control in Swift 用戶界面控件是所有應用程序重要的組成部分之一。它們以圖形組件的方式呈現給用戶&#xff0c;用戶可以通過它們與應用程序進行交互。蘋果提供了一套控件&#xff0c;例如 UITextField&#xff0c;UIButton&#xf…

【ArcGIS遇上Python】ArcGIS Python獲取Shapefile矢量數據字段名稱

借助PyCharm環境&#xff0c;在不打開ArcGIS的情況下&#xff0c;編寫Python代碼&#xff0c;獲取矢量數據的所有字段。 import arcpyshp C:\data\out\Export_Output.shp fields arcpy.ListFields(shp) for f in fields:print f.name‘,’f.type運行結果&#xff1a; C:\Pyt…

《聰明人和傻子和程序員》

本文借鑒自魯迅雜文《聰明人和傻子和奴才》&#xff0c;如有雷同&#xff0c;純屬巧合。有個程序員特別喜歡尋人訴苦&#xff0c;只要一點事&#xff0c;就喜歡訴苦。有一日&#xff0c;他遇到一個聰明人。“大佬。”他悲哀的說&#xff0c;“我們公司待遇越來越差了&#xff0…

c語言 case語句用法,switch ... case語句的用法[組圖]

switch ... case語句的用法[組圖]08-13欄目&#xff1a;技術TAG&#xff1a;switch case語句switch case語句當情況大于或等于4種的時候就用switch ... case語句copyright jhua.orgswitch(表達式) copyright jhua.org{ https://www.jhua.orgcase 常量1&#xff1a; 語句體1&am…