您的位置:極速下載站→ 資訊首頁 → 系統(tǒng)教程 → 系統(tǒng)資訊 → Centos以下RPM方式安裝MYSQL5.5教程
時(shí)間:2019-09-16 14:28:41 作者:無名 瀏覽量:19
首先去http://dev.mysql.com/downloads/mysql/5.5.html#downloads站點(diǎn)下載:
別離下載以下三個(gè)文件(由于我的機(jī)器是32位,下面是32位版別的包,假如你的機(jī)器是64位的請(qǐng)下載64位版別):
MySQL-server-5.5.16-1.rhel5.i386.rpm
MySQL-client-5.5.16-1.rhel4.i386.rpm
MySQL-devel-5.5.16-1.rhel4.i386.rpm
運(yùn)用wget指令運(yùn)用斷點(diǎn)傳輸?shù)姆椒▽⑦@三個(gè)文件下載
wget -c http://dev.mysql.com/get/Downloads/MySQL-5.5/MySQL-server-5.5.16-1.rhel4.i386.rpm/from/http://mysql.spd.co.il/
wget -c http://dev.mysql.com/get/Downloads/MySQL-5.5/MySQL-client-5.5.16-1.rhel4.i386.rpm/from/http://mysql.spd.co.il/
wget -c http://dev.mysql.com/get/Downloads/MySQL-5.5/MySQL-devel-5.5.16-1.rhel4.i386.rpm/from/http://mysql.spd.co.il/
下載完成后開始裝置:
rpm -ivh MySQL-server-5.5.16-1.rhel4.i386.rpm MySQL-client-5.5.16-1.rhel4.i386.rpm MySQL-devel-5.5.16-1.rhel4.i386.rpm
提示裝置完成后,輸入mysql 看是否裝置成功
mysql
假如呈現(xiàn)如下錯(cuò)誤信息:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
闡明mysql服務(wù)還沒有發(fā)動(dòng),輸入service mysql start發(fā)動(dòng)mysql服務(wù)
service mysql start
然后再輸入mysql,若呈現(xiàn)以下提示信息,闡明成功。
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.5.16 MySQL Community Server (GPL)
Copyright (c) 2000,2011,Oracle and/or its affiliates. All rights reserved.
Centos以下RPM方式安裝MYSQL5.5教程圖2
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
初次裝置時(shí),默認(rèn)暗碼為空,能夠運(yùn)用如下指令修改root暗碼,
mysqladmin -u root passwordmypassword
mypassword 為你設(shè)定的新暗碼
然后再次登錄
mysql -u root –p
rpm包裝置的MySQL是不會(huì)裝置/etc/my.cnf文件的,解決方法,只需要仿制/usr/share/mysql目錄下的my-huge.cnf 文件到/etc目錄,并改名為my.cnf即可
cp /usr/share/mysql/my-huge.cnf /etc/my.cnf
配置長(zhǎng)途拜訪
處于安全考慮,Mysql默認(rèn)是不允許長(zhǎng)途拜訪的,能夠運(yùn)用下面敞開長(zhǎng)途拜訪
//賦予任何主機(jī)拜訪數(shù)據(jù)的權(quán)限
Centos以下RPM方式安裝MYSQL5.5教程圖3
mysql>GRANT ALL PRIVILEGES ON *.* TO 'root'@'%'WITH GRANT OPTION
//使修改收效
mysql>FLUSH PRIVILEGES
假如仍然不能長(zhǎng)途拜訪的話,那就很可能防火墻的原因了,能夠在防火墻中敞開3306端口或者爽性關(guān)掉防火墻。
/etc/init.d/iptables status
會(huì)得到一系列信息,闡明防火墻開著。
/etc/init.d/iptables stop
永久封閉:
chkconfig --level 35 iptables off
以上是對(duì)自己初次在CentOS上裝置mysql的一個(gè)總結(jié),希望對(duì)大家有協(xié)助。