centos下安裝JAVA開發工具(3)——Mysql

source發表於2019-01-19

安裝MySQL

  1. 上傳MySQL-server-5.5.48-1.linux2.6.x8664.rpm到Linux上
  2. 解壓ta包 得到一大堆rpm檔案
    tar -xvf MySQL-5.6.25-1.el6.x86_64.rpm-bundle.tar

      MySQL-client-5.6.25-1.el6.x86_64.rpm
      MySQL-devel-5.6.25-1.el6.x86_64.rpm
      MySQL-embedded-5.6.25-1.el6.x86_64.rpm
      MySQL-server-5.6.25-1.el6.x86_64.rpm
      MySQL-shared-5.6.25-1.el6.x86_64.rpm
      MySQL-shared-compat-5.6.25-1.el6.x86_64.rpm
      MySQL-test-5.6.25-1.el6.x86_64.rpm
  3. rpm安裝mysql-server
    rpm -ivh MySQL-server-5.6.25-1.el6.x86_64.rpm

  4. 出現錯誤
    file /usr/share/mysql/charsets/cp1256.xml from install of MySQL-server-5.6.25-1.el6.x86_64 conflicts with file from package mariadb-libs-1:5.5.56-2.el7.x86_64

  5. 解除安裝 mariadb-libs-1:5.5.56-2.el7.x86_64 解決依賴
    rpm -e –nodeps mariadb-libs-1:5.5.56-2.el7.x86_64
  6. 再次執行第三步 安裝server
  7. 安裝客戶端
    rpm -ivhMySQL-client-5.6.25-1.el6.x86_64.rpm
  8. 啟動mysql
    service mysql start
  9. 初始化mysql
    /usr/bin/mysql_secure_installation
  10. 測試mysql
    mysql -u root -p

注意事項

初始化mysql時可能出現問題

  • 先關閉mysql
    service mysql stop
  • 跳過檢查
    service mysql start –skip-grant-tables
  • 進入mysql 設定密碼

    mysql> update mysql.user set password=PASSWORD(`newpassword`) where User=`root`; 
    mysql> flush privileges; 
    mysql> quit 
  • 重啟mysql
    service mysql start
  • 連線
    mysql -u root -p

備註

  • 修改mysql密碼
    set password for root@localhost = password(`123`);

相關文章