centos 6.x 安裝Mysql

來源:互聯網
上載者:User

標籤:style   os   io   使用   ar   for   資料   art   sp   

安裝之前應該先查詢系統是否自在了mysql的軟體包 

    rpm -qa|grep -i mysql

#如果有的話需要先刪除 rpm -e 軟體名 --nodeps

#To see all files in an RPM package (for example, a MySQL-server RPM), run a command like this:

rpm -qpl MySQL-server-VERSION.linux_glibc2.5.i386.rpm

#To perform a standard minimal installation, install the server and client RPMs:

rpm -ivh MySQL-server-VERSION.linux_glibc2.5.i386.rpm

rpm -ivh MySQL-client-VERSION.linux_glibc2.5.i386.rpm


#安裝後產生的一個隨機密碼在 /root/.mysql_secret 

#啟動 MySQL 

service mysql start 

#登入mysql 

mysql -u root -p

#修改密碼 

SET PASSWORD=password(‘password‘); 

#添加一個可遠程登入的帳號 

GRANT all privileges on *.* TO ‘root‘@‘%‘ identified by ‘password‘ WITH GRANT OPTION; 

FLUSH PRIVILEGES;

#修改密碼

SET PASSWORD FOR ‘root‘@‘%‘ = PASSWORD(‘password‘);


允許3306連接埠

iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 3306 -j ACCEPT

# 查看規則是否生效

iptables -L -n # 或者: service iptables status

# 此時生產環境是不安全的,遠端管理之後應該關閉連接埠,刪除之前添加的規則

iptables -D INPUT -p tcp -m state --state NEW -m tcp --dport 3306 -j ACCEPT

PS,上面iptables添加/刪除規則都是臨時的,如果需要重啟後也生效,需要儲存修改:

service iptables save # 或者: /etc/init.d/iptables save

另外,

vi /etc/sysconfig/iptables # 加上下面這行規則也是可以的

-A INPUT -p tcp -m state --state NEW -m tcp --dport 3306 -j ACCEPT

遠端管理資料庫的軟體,win系統下可以使用SQLyog,用了幾種遠程軟體,感覺這個用起來蠻不錯的。


centos 6.x 安裝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.