91超碰碰碰碰久久久久久综合_超碰av人澡人澡人澡人澡人掠_国产黄大片在线观看画质优化_txt小说免费全本

溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

MySQL 5.7部署分類

發布時間:2020-04-22 14:05:14 來源:億速云 閱讀:280 作者:三月 欄目:MySQL數據庫

本文主要給大家介紹MySQL 5.7部署分類,其所涉及的東西,從理論知識來獲悉,有很多書籍、文獻可供大家參考,從現實意義來講,億速云累計多年的實踐經驗可分享給大家。                                                    

MySQL5.7部署可以分為rpm包部署、源碼包部署、二進制包部署。

源碼包部署:優點是靈活性較高,可以自定義編譯參數,效率高,缺點是部署時間較長
二進制包部署:優點是事先已經編譯好,部署較快,可以自定義一部分參數,缺點是時間相比使用yum安裝,還是較長
rpm包部署:優點是部署速度快,缺點是定制性差
一般沒有特殊要求時,可以使用yum包部署
下面開始使用二進制包部署MySQL5.7.26二進制包
下載地址:https://dev.mysql.com/downloads/mysql/5.7.html#downloads
在Select Operating System選項中選中”Linux Generic",在最下方的Linux - Generic (glibc 2.12) (x86, 64-bit), TAR項后方的download即可下載
1.添加MySQL數據庫運行的用戶和用戶組

MySQL 5.7部署分類

groupadd -r mysql
useradd -r -g mysql mysql

2.此次MySQL部署的目錄為/application,將MySQL安裝包解壓到/application/mysql-5.7.26-linux-glibc2.12-x86_64目錄,并為此目錄創建軟鏈接

 ln -s /application/mysql-5.7.26-linux-glibc2.12-x86_64 /application/mysql

更改目錄權限
chown -R mysql:mysql /application/mysql-5.7.26-linux-glibc2.12-x86_64
3.初始化數據庫

/application/mysql-5.7.26-linux-glibc2.12-x86_64/bin/mysqld --initialize --user=mysql --basedir=/application/mysql --datadir=/application/mysql/data

[root@chanye application]# /application/mysql-5.7.26-linux-glibc2.12-x86_64/bin/mysqld --initialize --user=mysql --basedir=/application/mysql --datadir=/application/mysql/data
2019-06-18T08:35:49.103727Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2019-06-18T08:35:49.885283Z 0 [Warning] InnoDB: New log files created, LSN=45790
2019-06-18T08:35:49.944856Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.
2019-06-18T08:35:50.002905Z 0 [Warning] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: 138aa81a-91a4-11e9-8f49-005056813525.
2019-06-18T08:35:50.004044Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
2019-06-18T08:35:50.004493Z 1 [Note] A temporary password is generated for root@localhost: O;iSA6z>SieK

記住最后一行的臨時密碼
4.創建RSA  private key

/application/mysql/bin/mysql_ssl_rsa_setup --datadir=/application/mysql/data
Generating a 2048 bit RSA private key
..........................................................................................+++
....+++
writing new private key to 'ca-key.pem'
-----
Generating a 2048 bit RSA private key
............................+++
.+++
writing new private key to 'server-key.pem'
-----
Generating a 2048 bit RSA private key
..........................................................................+++
...........................................................................................+++
writing new private key to 'client-key.pem'

5.添加mysql到開機自啟動

cp /application/mysql-5.7.26-linux-glibc2.12-x86_64/support-files/mysql.server /etc/init.d/mysqld

修改/etc/init.d/mysqld中的basedir和datadir

46 basedir=/application/mysql
 47 datadir=/application/mysql/data

加入開機自啟動

chkconfig mysqld on
chkconfig --list mysqld
Note: This output shows SysV services only and does not include native
      systemd services. SysV configuration data might be overridden by native
      systemd configuration.

      If you want to list systemd services use 'systemctl list-unit-files'.
      To see services enabled on particular target use
      'systemctl list-dependencies [target]'.

mysqld          0:off   1:off   2:on    3:on    4:on    5:on    6:off

修改全局配置文件將mysql可執行路徑加入到PATH,在/etc/profile最后一行添加:

export PATH=/application/mysql/bin:$PATH

使用source /etc/profile使配置生效
刪掉系統自帶的/etc/my.cnf或者改名,在/application/mysql/目錄新建my.cnf,并且將文件屬性調整為mysql:mysql

[mysqld]
character-set-server=utf8
datadir=/application/mysql/data
socket=/application/mysql/mysql.sock
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
# Settings user and group are ignored when systemd is used.
# If you need to run mysqld under a different user or group,
# customize your systemd unit file for mariadb according to the
# instructions in http://fedoraproject.org/wiki/Systemd

#
# include all files from the config directory
#
!includedir /etc/my.cnf.d

[client]
character-set-server=utf8
socket=/application/mysql/mysql.sock

[mysql]
character-set-server=utf8
socket=/application/mysql/mysql.sock

6.啟動mysql
啟動mysql

/etc/init.d/mysqld start

此時使用初始化提供的密碼進行登陸

# mysql -uroot -p
Enter password: 
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)

系統默認的客戶端使用的mysql.sock文件是基于unix sock的,此時最簡便的辦法是創建一個軟鏈接

ln -s /application/mysql/mysql.sock /tmp/mysql.sock

如果不創建軟鏈接,使用mysql命令登陸的時候使用-S選項,手工指定mysql.sock的位置也是可以登陸的
登陸成功后需要更改管理員密碼

alter user 'root'@'localhost' identified by '598545$kdOctamvsU';
flush privileges;

查看mysql狀態

mysql> status;
--------------
mysql  Ver 14.14 Distrib 5.7.26, for linux-glibc2.12 (x86_64) using  EditLine wrapper

Connection id:      4
Current database:   
Current user:       root@localhost
SSL:            Not in use
Current pager:      stdout
Using outfile:      ''
Using delimiter:    ;
Server version:     5.7.26 MySQL Community Server (GPL)
Protocol version:   10
Connection:     Localhost via UNIX socket
Server characterset:    utf8
Db     characterset:    utf8
Client characterset:    utf8
Conn.  characterset:    utf8
UNIX socket:        /application/mysql/mysql.sock
Uptime:         7 min 56 sec

Threads: 2  Questions: 14  Slow queries: 0  Opens: 116  Flush tables: 1  Open tables: 109  Queries per second avg: 0.029

--------------

看了以上介紹MySQL 5.7部署分類,希望能給大家在實際運用中帶來一定的幫助。本文由于篇幅有限,難免會有不足和需要補充的地方,大家可以繼續關注億速云行業資訊板塊,會定期給大家更新行業新聞和知識,如有需要更加專業的解答,可在官網聯系我們的24小時售前售后,隨時幫您解答問題的。

向AI問一下細節

免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

AI

巴林左旗| 信宜市| 体育| 尉犁县| 新源县| 思南县| 襄汾县| 海丰县| 马尔康县| 渭南市| 洛浦县| 乐平市| 甘谷县| 揭阳市| 镇赉县| 衡水市| 江安县| 襄垣县| 淮北市| 清水县| 洛宁县| 蒲城县| 和林格尔县| 雅江县| 临清市| 德江县| 中宁县| 黄骅市| 双鸭山市| 兴宁市| 平果县| 红河县| 大荔县| 乐都县| 安岳县| 长葛市| 淮阳县| 江山市| 徐汇区| 天峻县| 潮安县|