Manjaro|配置MySql數(shù)據(jù)庫(kù)

安裝并初始化MySql

sudo pacman -S mysql
正在安裝 mysql-clients (8.0.11-1)...
正在安裝 mysql (8.0.11-1)...
:: You need to initialize the MySQL data directory prior to starting
   the service. This can be done with mysqld --initialize command, e.g.:
   mysqld --initialize --user=mysql --basedir=/usr --datadir=/var/lib/mysql
:: Additionally you should secure your MySQL installation using
   mysql_secure_installation command after starting the mysqld service

初始化MySql數(shù)據(jù)目錄/注意記錄root臨時(shí)密碼

mysqld --initialize --user=mysql --basedir=/usr --datadir=/var/lib/mysql

查看MySql狀態(tài)

sudo systemctl status mysqld

啟動(dòng)MySql服務(wù)/開機(jī)自啟

sudo systemctl enable mysqld
sudo systemctl start mysqld

賬戶安全設(shè)置/需要使用root臨時(shí)密碼登陸

mysql_secure_installation 

使用workbench連接時(shí)需要修改密碼規(guī)則

#出現(xiàn)
caching_sha2_password cannot be loaded

ALTER USER 'root'@'localhost' IDENTIFIED BY 'password' PASSWORD EXPIRE NEVER; #修改加密規(guī)則 
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password'; #更新一下用戶的密碼 
 FLUSH PRIVILEGES; #刷新權(quán)限 

再重置下密碼:alter user 'root'@'localhost' identified by '123qwe';

ERROR(重新安裝后已解決)

Can't connect to local MySQL server through socket '/run/mysqld/mysqld.sock' (2)
● mysqld.service - MySQL database server
   Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled)
   Active: activating (start-post) (Result: exit-code) since Sat 2018-05-26 19:41:34 CST; 18s ago
  Process: 8359 ExecStart=/usr/bin/mysqld --pid-file=/run/mysqld/mysqld.pid (code=exited, status=1/FAILURE)
 Main PID: 8359 (code=exited, status=1/FAILURE); Control PID: 8360 (mysqld-post)
    Tasks: 2 (limit: 4722)
   Memory: 1.2M
   CGroup: /system.slice/mysqld.service
           ├─8360 /bin/sh /usr/bin/mysqld-post
           └─8560 sleep 1

5月 26 19:41:35 dexter0ion-pc mysqld[8359]: 2018-05-26T11:41:34.907694Z 0 [Warning] [MY-010139] [Server] Changed limits: >
5月 26 19:41:35 dexter0ion-pc mysqld[8359]: 2018-05-26T11:41:34.907742Z 0 [Warning] [MY-010142] [Server] Changed limits: >
5月 26 19:41:35 dexter0ion-pc mysqld[8359]: 2018-05-26T11:41:35.121790Z 0 [Warning] [MY-010915] [Server] 'NO_ZERO_DATE', >
5月 26 19:41:35 dexter0ion-pc mysqld[8359]: 2018-05-26T11:41:35.121870Z 0 [System] [MY-010116] [Server] /usr/bin/mysqld (>
5月 26 19:41:35 dexter0ion-pc mysqld[8359]: 2018-05-26T11:41:35.123947Z 0 [Warning] [MY-010091] [Server] Can't create tes>
5月 26 19:41:35 dexter0ion-pc mysqld[8359]: 2018-05-26T11:41:35.123965Z 0 [Warning] [MY-010159] [Server] Setting lower_ca>
5月 26 19:41:35 dexter0ion-pc mysqld[8359]: 2018-05-26T11:41:35.124479Z 0 [ERROR] [MY-010172] [Server] failed to set data>
5月 26 19:41:35 dexter0ion-pc mysqld[8359]: 2018-05-26T11:41:35.124653Z 0 [ERROR] [MY-010119] [Server] Aborting
5月 26 19:41:35 dexter0ion-pc mysqld[8359]: 2018-05-26T11:41:35.124793Z 0 [System] [MY-010910] [Server] /usr/bin/mysqld: >
5月 26 19:41:35 dexter0ion-pc systemd[1]: mysqld.service: Main process exited, code=exited, status=1/FAILURE
~
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容