centos msyql 安裝與配置

來源:互聯網
上載者:User

標籤:

Mysql具有簡單易學、體積小等優點,深受編程開發初學者的喜愛

工具/原料
  • 接入Internet的Centos電腦
安裝Mysql
  1. 1

    Centos 6.6下安裝Mysql很簡單,

    yum list mysql-server

  2. 2

    當只有一個時候就可以直接

    yum install mysql-server

    進行安裝

  3. 3

    過程中選擇Y繼續安裝,最後安裝成功

    END
設定Mysql的服務
  1. 1

    先啟動Mysql服務

    service mysqld start

  2. 2

    串連一下試一下,直接

    mysql

    然後

    \q

    關閉串連

  3. 3

    設定Mysql開機啟動

    chkconfig mysqld on

  4. 4

    開啟3306連接埠並儲存

    /sbin/iptables -I INPUT -p tcp --dport 3306 -j ACCEPT

    /etc/rc.d/init.d/iptables save

    END
修改密碼並設定遠端存取
  1. 1

    串連mysql資料庫

    設定密碼

    use mysql;

    update user set password=password(‘密碼‘) where user=‘root‘;

    flush privileges;

  2. 2

    設定Mysql遠端存取

    grant all privileges on *.* to ‘root‘@‘%‘ identified by ‘123456‘ with grant option;

    END
解決Mysql亂碼問題
  1.  

    找一個設定檔,複製到/etc/目錄,命名為my.cnf

    (有時候沒有my.cnf)

    cp /usr/share/doc/mysql-server-5.1.73/my-medium.cnf /etc/my.cnf

  2. 2

    vim my.cnf

    在[client]和[mysqld]下面都添加上

    default-character-set=utf8

  3. 3

    最後按Esc輸入

    :wq

    儲存退出

    END
重啟mysql服務
  1. 1

    最後重新啟動服務就可以了

    service mysqld restart

centos msyql 安裝與配置

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.