centos7 安裝Mysql8.0筆記


 

wget https://dev.mysql.com/get/mysql80-community-release-el7-1.noarch.rpm
  • 安裝yum源
yum localinstall mysql80-community-release-el7-1.noarch.rpm
  • 更新yum源
yum clean all
yum makecache
  • 開始安裝MySQL
yum install mysql-community-server
  • 查看初始化密碼

 

cat /var/log/mysqld.log | grep password

 

  • MYSQL 安全設置 需要使用使用上一步root密碼登錄, 
  • 接下來,為了安全,MySQL 會提示你重置 root 密碼,移除其他用戶賬號,禁用 root 遠程登錄,移除 test 數據庫,重新加載 privilege 表格等,你只需輸入 y 繼續執行即可
  • 如果報錯  Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)最簡單方法重啟下服務器,系統會生成一個新mysql.sock文件, 參考: https://blog.csdn.net/HeatDeath/article/details/79065872
mysql_secure_installation -p
  • 登錄MySQL
mysql -u root -p
  • 先創建用戶(密碼規則:mysql8.0以上密碼策略限制必須要大小寫加數字特殊符號)
  • 此處%是指允許該用戶在任何電腦上登錄, localhost指指允許本地登錄  ip指允許指定ip登錄
create user test@'%' identified  by 'Aa-123456';
  • 給用戶授權
  • 參數: grant 權限 on 數據庫.表名 to 用戶名@登錄主機
grant all privileges on *.* to test@'%' with grant option;
flush privileges;
  • 遠程連接報錯 Unable to load authentication plugin 'caching_sha2_password'.
  • 是因為mysql8使用的是caching_sha2_password加密規則,最簡單的方法是修改遠程連接用戶的加密規則:
ALTER USER 'test'@'%' IDENTIFIED WITH mysql_native_password BY 'Aa-123456';

參考鏈接: https://segmentfault.com/a/1190000015634108

      https://blog.csdn.net/SZStudy/article/details/80561207

      https://blog.csdn.net/HeatDeath/article/details/79065872


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM