您好,登錄后才能下訂單哦!
本篇內(nèi)容主要講解“centos安裝mysql數(shù)據(jù)庫(kù)的過程介紹”,感興趣的朋友不妨來看看。本文介紹的方法操作簡(jiǎn)單快捷,實(shí)用性強(qiáng)。下面就讓小編來帶大家學(xué)習(xí)“centos安裝mysql數(shù)據(jù)庫(kù)的過程介紹”吧!
1、首先下載MySQL的安裝文件,我這里安裝的是MySQL5.1.7版本的,
2、安裝MySQL數(shù)據(jù)庫(kù)服務(wù)器
進(jìn)入安裝包所在文件夾,執(zhí)行命令 rpm -ivh MySQL-server-5.1.7-0.i386.rpm 安裝MySQL服務(wù)器。
如果報(bào)了與原先版本沖突的話,就執(zhí)行rpm -qa|grep -i mysql命令,會(huì)顯示已安裝的Mysql版本,我的顯示mysql-libs-5.1.61-4.el6.i686
這時(shí)如果有的話就強(qiáng)制刪除:rpm -e --nodeps mysql-libs-5.1.61-4.el6.i686(因?yàn)橛邪蕾?,所以要?qiáng)制刪除)
我的報(bào)錯(cuò)提示如下:
代碼如下:
MySQL-server-5.1.7-0.i386.rpm
Preparing... ########################################### [100%]
file /usr/share/mysql/charsets/README from install of MySQL-server-5.1.7-0.i386.rpm conflicts with file from package mysql-libs-5.1.61-4.el6.i686
file /usr/share/mysql/charsets/Index.xml from install of MySQL-server-5.1.7-0.i386.rpm conflicts with file from package mysql-libs-5.1.61-4.el6.i686
file /usr/share/mysql/charsets/armscii8.xml from install of MySQL-server-5.1.7-0.i386.rpm conflicts with file from package mysql-libs-5.1.61-4.el6.i686
file /usr/share/mysql/charsets/ascii.xml from install of MySQL-server-5.1.7-0.i386.rpm conflicts with file from package mysql-libs-5.1.61-4.el6.i686
file /usr/share/mysql/charsets/cp1250.xml from install of MySQL-server-5.1.7-0.i386.rpm conflicts with file from package mysql-libs-5.1.61-4.el6.i686
file /usr/share/mysql/charsets/cp1251.xml from install of MySQL-server-5.1.7-0.i386.rpm conflicts with file from package mysql-libs-5.1.61-4.el6.i686
file /usr/share/mysql/charsets/cp1256.xml from install of MySQL-server-5.1.7-0.i386.rpm conflicts with file from package mysql-libs-5.1.61-4.el6.i686
file /usr/share/mysql/charsets/cp1257.xml from install of MySQL-server-5.1.7-0.i386.rpm conflicts with file from package mysql-libs-5.1.61-4.el6.i686
file /usr/share/mysql/charsets/cp850.xml from install of MySQL-server-5.1.7-0.i386.rpm conflicts with file from package mysql-libs-5.1.61-4.el6.i686
file /usr/share/mysql/charsets/cp852.xml from install of MySQL-server-5.1.7-0.i386.rpm conflicts with file from package mysql-libs-5.1.61-4.el6.i686
file /usr/share/mysql/charsets/cp866.xml from install of MySQL-server-5.1.7-0.i386.rpm conflicts with file from package mysql-libs-5.1.61-4.el6.i686
file /usr/share/mysql/charsets/dec8.xml from install of MySQL-server-5.1.7-0.i386.rpm conflicts with file from package mysql-libs-5.1.61-4.el6.i686
file /usr/share/mysql/charsets/geostd8.xml from install of MySQL-server-5.1.7-0.i386.rpm conflicts with file from package mysql-libs-5.1.61-4.el6.i686
file /usr/share/mysql/charsets/greek.xml from install of MySQL-server-5.1.7-0.i386.rpm conflicts with file from package mysql-libs-5.1.61-4.el6.i686
file /usr/share/mysql/charsets/hebrew.xml from install of MySQL-server-5.1.7-0.i386.rpm conflicts with file from package mysql-libs-5.1.61-4.el6.i686
file /usr/share/mysql/charsets/hp8.xml from install of MySQL-server-5.1.7-0.i386.rpm conflicts with file from package mysql-libs-5.1.61-4.el6.i686
file /usr/share/mysql/charsets/keybcs2.xml from install of MySQL-server-5.1.7-0.i386.rpm conflicts with file from package mysql-libs-5.1.61-4.el6.i686
file /usr/share/mysql/charsets/koi8r.xml from install of MySQL-server-5.1.7-0.i386.rpm conflicts with file from package mysql-libs-5.1.61-4.el6.i686
file /usr/share/mysql/charsets/koi8u.xml from install of MySQL-server-5.1.7-0.i386.rpm conflicts with file from package mysql-libs-5.1.61-4.el6.i686
file /usr/share/mysql/charsets/latin1.xml from install of MySQL-server-5.1.7-0.i386.rpm conflicts with file from package mysql-libs-5.1.61-4.el6.i686
file /usr/share/mysql/charsets/latin2.xml from install of MySQL-server-5.1.7-0.i386.rpm conflicts with file from package mysql-libs-5.1.61-4.el6.i686
file /usr/share/mysql/charsets/latin5.xml from install of MySQL-server-5.1.7-0.i386.rpm conflicts with file from package mysql-libs-5.1.61-4.el6.i686
file /usr/share/mysql/charsets/latin7.xml from install of MySQL-server-5.1.7-0.i386.rpm conflicts with file from package mysql-libs-5.1.61-4.el6.i686
file /usr/share/mysql/charsets/macce.xml from install of MySQL-server-5.1.7-0.i386.rpm conflicts with file from package mysql-libs-5.1.61-4.el6.i686
file /usr/share/mysql/charsets/macroman.xml from install of MySQL-server-5.1.7-0.i386.rpm conflicts with file from package mysql-libs-5.1.61-4.el6.i686
file /usr/share/mysql/charsets/swe7.xml from install of MySQL-server-5.1.7-0.i386.rpm conflicts with file from package mysql-libs-5.1.61-4.el6.i686
file /usr/share/mysql/czech/errmsg.sys from install of MySQL-server-5.1.7-0.i386.rpm conflicts with file from package mysql-libs-5.1.61-4.el6.i686
file /usr/share/mysql/danish/errmsg.sys from install of MySQL-server-5.1.7-0.i386.rpm conflicts with file from package mysql-libs-5.1.61-4.el6.i686
file /usr/share/mysql/dutch/errmsg.sys from install of MySQL-server-5.1.7-0.i386.rpm conflicts with file from package mysql-libs-5.1.61-4.el6.i686
file /usr/share/mysql/english/errmsg.sys from install of MySQL-server-5.1.7-0.i386.rpm conflicts with file from package mysql-libs-5.1.61-4.el6.i686
file /usr/share/mysql/estonian/errmsg.sys from install of MySQL-server-5.1.7-0.i386.rpm conflicts with file from package mysql-libs-5.1.61-4.el6.i686
file /usr/share/mysql/french/errmsg.sys from install of MySQL-server-5.1.7-0.i386.rpm conflicts with file from package mysql-libs-5.1.61-4.el6.i686
file /usr/share/mysql/german/errmsg.sys from install of MySQL-server-5.1.7-0.i386.rpm conflicts with file from package mysql-libs-5.1.61-4.el6.i686
file /usr/share/mysql/greek/errmsg.sys from install of MySQL-server-5.1.7-0.i386.rpm conflicts with file from package mysql-libs-5.1.61-4.el6.i686
file /usr/share/mysql/hungarian/errmsg.sys from install of MySQL-server-5.1.7-0.i386.rpm conflicts with file from package mysql-libs-5.1.61-4.el6.i686
file /usr/share/mysql/italian/errmsg.sys from install of MySQL-server-5.1.7-0.i386.rpm conflicts with file from package mysql-libs-5.1.61-4.el6.i686
file /usr/share/mysql/japanese/errmsg.sys from install of MySQL-server-5.1.7-0.i386.rpm conflicts with file from package mysql-libs-5.1.61-4.el6.i686
file /usr/share/mysql/korean/errmsg.sys from install of MySQL-server-5.1.7-0.i386.rpm conflicts with file from package mysql-libs-5.1.61-4.el6.i686
file /usr/share/mysql/norwegian-ny/errmsg.sys from install of MySQL-server-5.1.7-0.i386.rpm conflicts with file from package mysql-libs-5.1.61-4.el6.i686
file /usr/share/mysql/norwegian/errmsg.sys from install of MySQL-server-5.1.7-0.i386.rpm conflicts with file from package mysql-libs-5.1.61-4.el6.i686
file /usr/share/mysql/polish/errmsg.sys from install of MySQL-server-5.1.7-0.i386.rpm conflicts with file from package mysql-libs-5.1.61-4.el6.i686
file /usr/share/mysql/portuguese/errmsg.sys from install of MySQL-server-5.1.7-0.i386.rpm conflicts with file from package mysql-libs-5.1.61-4.el6.i686
file /usr/share/mysql/romanian/errmsg.sys from install of MySQL-server-5.1.7-0.i386.rpm conflicts with file from package mysql-libs-5.1.61-4.el6.i686
file /usr/share/mysql/russian/errmsg.sys from install of MySQL-server-5.1.7-0.i386.rpm conflicts with file from package mysql-libs-5.1.61-4.el6.i686
file /usr/share/mysql/serbian/errmsg.sys from install of MySQL-server-5.1.7-0.i386.rpm conflicts with file from package mysql-libs-5.1.61-4.el6.i686
file /usr/share/mysql/slovak/errmsg.sys from install of MySQL-server-5.1.7-0.i386.rpm conflicts with file from package mysql-libs-5.1.61-4.el6.i686
file /usr/share/mysql/spanish/errmsg.sys from install of MySQL-server-5.1.7-0.i386.rpm conflicts with file from package mysql-libs-5.1.61-4.el6.i686
file /usr/share/mysql/swedish/errmsg.sys from install of MySQL-server-5.1.7-0.i386.rpm conflicts with file from package mysql-libs-5.1.61-4.el6.i686
file /usr/share/mysql/ukrainian/errmsg.sys from install of MySQL-server-5.1.7-0.i386.rpm conflicts with file from package mysql-libs-5.1.61-4.el6.i686
這時(shí)候再執(zhí)行rpm -ivh MySQL-server-5.1.7-0.i386.rpm安裝即可安裝成功。
我這里安裝成功了,但是mysql服務(wù)無法啟動(dòng),總是啟動(dòng)失敗,后來百度了一下,是因?yàn)閟elinux的原因,只要將selinux關(guān)閉就OK了。
關(guān)閉selinux:vi /etc/selinux/config 將SELINUX=enforcing 改成SELINUX=disabled 然后重啟
關(guān)閉selinux之后還是無法啟動(dòng)mysql服務(wù),因?yàn)榘惭b的mysql所有者是root,在安裝mysql的時(shí)候會(huì)創(chuàng)建一個(gè)用戶mysql,只要將/var/lib/mysql
的所有者改為mysql就OK了,執(zhí)行命令chown -R mysql:mysql /var/lib/mysql
現(xiàn)在執(zhí)行service mysql start終于可以啟動(dòng)mysql服務(wù)了。
3.安裝MySQL客戶端
執(zhí)行命令rpm -ivh MySQL-client-5.1.7-0.i386.rpm進(jìn)行安裝。
4.安裝成功
成功安裝MySQL后將sql文件導(dǎo)入到數(shù)據(jù)庫(kù),步驟如下:
進(jìn)入MYSQL Command Line Client
1、先創(chuàng)建數(shù)據(jù)庫(kù):create database test 注:test是創(chuàng)建數(shù)據(jù)庫(kù)的名稱
2、再切換到當(dāng)前數(shù)據(jù)庫(kù):use test
3、再輸入:\. /root/test.sql 或 souce /root/test.sql
按照以上步驟就可以將備份的sql腳本導(dǎo)入到linux中的數(shù)據(jù)庫(kù)中去。
到此,相信大家對(duì)“centos安裝mysql數(shù)據(jù)庫(kù)的過程介紹”有了更深的了解,不妨來實(shí)際操作一番吧!這里是億速云網(wǎng)站,更多相關(guān)內(nèi)容可以進(jìn)入相關(guān)頻道進(jìn)行查詢,關(guān)注我們,繼續(xù)學(xué)習(xí)!
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長(zhǎng)郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。