1. 程式人生 > >Linux安裝mysql.8.0.12

Linux安裝mysql.8.0.12

sof grep erro listen lis int log linux target


1. linux安裝mysql8.0.12,親測可用。

以下是安裝過程中出現的問題:

 1 [root@localtest1 file]# systemctl start mysqld
 2 Job for mysqld.service failed because the control process exited with error code. See "systemctl status mysqld.service" and "journalctl -xe" for details.
 3 
 4 [root@localtest1 file]# systemctl status mysqld
 5 ● mysqld.service - MySQL Server
 6    Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled)
 7    Active: failed (Result: exit-code) since Tue 2018-09-11 19:58:27 CST; 15s ago
 8      Docs: man:mysqld(8)
 9            http://dev.mysql.com/doc/refman/en/using-systemd.html
10   Process: 29481 ExecStart=/usr/sbin/mysqld $MYSQLD_OPTS (code=exited, status=1/FAILURE)
11   Process: 29454 ExecStartPre=/usr/bin/mysqld_pre_systemd (code=exited, status=0/SUCCESS)
12  Main PID: 29481 (code=exited, status=1/FAILURE)
13    Status: "SERVER_BOOTING"
14     Error: 98 (Address already in use)
15 
16 Sep 11 19:58:23 localtest1.guandata.com systemd[1]: Starting MySQL Server...
17 Sep 11 19:58:27 localtest1.guandata.com systemd[1]: mysqld.service: main process exited, code=exited, status=1/FAILURE
18 Sep 11 19:58:27 localtest1.guandata.com systemd[1]: Failed to start MySQL Server.
19 Sep 11 19:58:27 localtest1.guandata.com systemd[1]: Unit mysqld.service entered failed state.
20 Sep 11 19:58:27 localtest1.guandata.com systemd[1]: mysqld.service failed.
21 [root@localtest1 file]# lsof -i :3306
22 COMMAND     PID USER   FD   TYPE   DEVICE SIZE/OFF NODE NAME
23 docker-pr 17413 root    4u  IPv6 23187758      0t0  TCP *:mysql (LISTEN)
24 
25 原因:docker中已使用mysql並占用3306端口。由於我是測試自己的項目,就改了自己的mysql的端口號,重新裝了一個mysql。
修改mysql端口號:
[root@localtest1 file]# vi /etc/my.cnf
增加行:
port=7566

2. 安裝過程中會用到的linux命令

 1 啟動mysqld服務
 2 systemctl start mysqld
 3 
 4 查看mysqld狀態
 5 systemctl status mysqld
 6 
 7 查看mysql日誌
 8 tail -n 100 /var/log/mysqld.log  
 9 
10 列出誰在使用某個端口(https://www.cnblogs.com/sparkbj/p/7161669.html)
11 lsof -i :7566 12 13 netstat命令用來打印Linux中網絡系統的狀態信息 14 netstat -anp|grep 0715

3. MySQL.8.0.12密碼修改策略

Linux安裝mysql.8.0.12