linux系統安裝mysql及相關配置

來源:互聯網
上載者:User

標籤:io   ar   使用   sp   資料   on   art   bs   ad   

  1. 安裝
    1. server安裝。使用命令:sudo yum -y install mysql-server
    2. client安裝。使用命令:sudo yum -y install mysql
  2. 設定開機啟動
    1.  sudo /sbin/chkconfig --add mysqld
    2. sudo /sbin/chkconfig mysqld on  
    3. sudo /sbin/service mysqld start
  3. 設定root密碼
    1. sudo mysqladmin -u root password ‘test123‘
  4. 串連mysql
    1. mysql -u root -p test123
  5. 修改root遠端存取許可權
    1. 關閉mysqld服務:sudo /sbin/service mysqld stop
    2. 安全模式登入:sudo mysqld_safe --user=mysql --skip-grant-tables --skip-networking &
    3. 執行當前許可權查詢命令:show grants; (此步驟可選)
    4. 添加許可權:Grant all privileges on *.* to ‘root‘@‘*‘ identified by ‘123456‘ with grant option;
    5. 重新整理許可權表:flush privileges;
    6. 退出mysql:quit
    7. 重啟mysql服務:sudo /sbin/service mysqld start
    8. iptables開啟3306服務:

       #/sbin/iptables -I INPUT -p tcp --dport 3306 -j ACCEPT
       #/etc/rc.d/init.d/iptables save  儲存:

       # service iptables restart  重啟生效

    9. 或者關閉防火牆:sudo service iptables stop
    10. 使用遠程db工具如navicat進行串連
  6. 建立資料庫:create database XXX;
  7. 進入資料庫:use XXX;

linux系統安裝mysql及相關配置

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.