Ubuntu Server 18.04 与 MySQL 5.7
【walker 過程】
安裝
在?/etc/mysql/mysql.conf.d/mysqld.cnf 文件里面修改或添加
重啟 mysql 服務
查看是否修改成功(數值的單位是 Bytes)
設置遠程 root 訪問
注意:update user set authentication_string=password('xxxx') where user='root';?語句會與遠程授權沖突。
mysql?-u?root mysql>?use?mysql; #?authentication_string?以前叫?password mysql>?select?user,?host,?authentication_string?from?user; #?設置任意?ip?可使用?root?連接 mysql>?update?user?set?host='%'?where?user='root'; #?xxxx?為遠程訪問密碼 mysql>?grant?all?privileges?on?*.*?to?'root'@'%'?identified?by?'xxxx'?with?grant?option;? #?刷新權限 mysql>?flush?privileges;【修改字符集為 utf8/utf8mb4】
參考:Ubuntu中MySQL5.7設置utf8編碼格式步驟
查看字符集
合二為一:
SHOW?VARIABLES?WHERE?Variable_name?LIKE?'character_set_%'?OR?Variable_name?LIKE?'collation_%'; #?OR SHOW?VARIABLES?WHERE?Variable_name?REGEXP?'^(character_set_|collation_).*';在?/etc/mysql/mysql.conf.d/mysqld.cnf 文件里面修改或添加
在?/etc/mysql/conf.d/mysql.cnf 文件里面修改或添加
重啟 mysql 服務
再次查看
【相關命令】
安全檢查
查看授權
密碼策略相關
卸載 mysql 及配置文件
【FAQ】
Q:導入數據報錯?lost connection to MySQL server during query?
A:可能原因是?max_allowed_packet 值過小。查詢的方法:SHOW VARIABLES LIKE '%max_allowed_packet%';。可通過修改?/etc/mysql/mysql.conf.d/mysqld.cnf 里面的? max_allowed_packet 配置項調整。注意這個值并不需要比導入的 sql 文件大。當然也可能是網絡問題(網卡、網線、交換機接口等)。
【相關閱讀】
MySQL 5.7 安裝完成后,立即要調整的性能選項
MySQL 安全檢查:MySQL安全配置向導mysql_secure_installation
Ubuntu Server 18.04 切換軟件源到國內鏡像
ubuntu18.04 安裝mongodb并使用Robo 3T連接Mongodb數據庫(作者寫這篇文章的時候 mongodb bionic 版本尚未發布)
***?walker?***
轉載于:https://blog.51cto.com/walkerqt/2114531
總結
以上是生活随笔為你收集整理的Ubuntu Server 18.04 与 MySQL 5.7的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 【微信小程序】初识小程序
- 下一篇: 12.1 LNMP架构介绍 12.2 M