【linux】之安裝mysql常用配置

來源:互聯網
上載者:User

標籤:iptables   ide   規則   更改密碼   table   blog   搜尋   res   使用者   

下載mysql地址

http://dev.mysql.com/downloads/mysql/

選擇下面這個

 

 

查看是否存在mysql安裝包

rpm -qa|grep -i mysql

刪除mysql安裝包 --nodeps 忽略依賴關係
rpm -e --nodeps mysql-libs-5.1.61-4.el6.i686

安裝mysql服務端
rpm -ivh MySQL-server-5.5.50-1.el6.i686.rpm

安裝mysql用戶端
rpm -ivh MySQL-client-5.5.50-1.el6.i686.rpm

--------------------------------------------------------
配置mysql初始密碼
mysqladmin -uroot password root

mysqladmin -u root -p password 1234

如果以上配置出現一下錯誤

那麼用以下方法

[[email protected] mysql]# mysqld_safe --user=mysql --skip-grant-tables --skip-networking &

mysql> UPDATE user SET Password=PASSWORD(‘root‘) where USER=‘root‘;

mysql> FLUSH PRIVILEGES;

-------------------------------------------------------

mysql
登入進去之後更改密碼
set password=password(‘123‘);

加入到系統服務列表
chkconfig --add mysql

自動啟動
chkconfig mysql on

查看自動啟動列表
chkconfig

 

登入mysql

例如,你想root使用root密碼 從任何主機串連到mysql伺服器的話。
GRANT ALL PRIVILEGES ON *.* TO ‘root‘@‘%‘IDENTIFIED BY ‘root‘ WITH GRANT OPTION;

如果你想允許使用者myuser從ip為192.168.1.6的主機串連到mysql伺服器,並使用mypassword作為密碼

GRANT ALL PRIVILEGES ON *.* TO ‘myuser‘@‘192.168.1.3‘IDENTIFIED BY

‘mypassword‘ WITH GRANT OPTION;

 

需要重新整理一下才會生效
FLUSH PRIVILEGES

 

切換到外部

開放3306連接埠
/sbin/iptables -I INPUT -p tcp --dport 3306 -j ACCEPT
儲存防火牆規則
/etc/rc.d/init.d/iptables save
重新整理防火牆規則
service iptables save
service iptables restart
以上兩個都行

查看連接埠開放情況

/etc/init.d/iptables status 

ls | grep mysql 檔案搜尋

 

以上配置在centos6.3下,我將所有需要的依賴已經全部安裝,如果出現相關錯誤,請安裝相應的依賴lib檔案

 

【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.