linux下安裝MySQL-5.6.31采用yum-yinstall命令安裝的示例分析

這期內(nèi)容當(dāng)中小編將會(huì)給大家?guī)碛嘘P(guān)linux下安裝MySQL-5.6.31采用yum -y install 命令安裝的示例分析,文章內(nèi)容豐富且以專業(yè)的角度為大家分析和敘述,閱讀完這篇文章希望大家可以有所收獲。

成都創(chuàng)新互聯(lián)是一家集網(wǎng)站建設(shè),欒城企業(yè)網(wǎng)站建設(shè),欒城品牌網(wǎng)站建設(shè),網(wǎng)站定制,欒城網(wǎng)站建設(shè)報(bào)價(jià),網(wǎng)絡(luò)營(yíng)銷,網(wǎng)絡(luò)優(yōu)化,欒城網(wǎng)站推廣為一體的創(chuàng)新建站企業(yè),幫助傳統(tǒng)企業(yè)提升企業(yè)形象加強(qiáng)企業(yè)競(jìng)爭(zhēng)力??沙浞譂M足這一群體相比中小企業(yè)更為豐富、高端、多元的互聯(lián)網(wǎng)需求。同時(shí)我們時(shí)刻保持專業(yè)、時(shí)尚、前沿,時(shí)刻以成就客戶成長(zhǎng)自我,堅(jiān)持不斷學(xué)習(xí)、思考、沉淀、凈化自己,讓我們?yōu)楦嗟钠髽I(yè)打造出實(shí)用型網(wǎng)站。

1 安裝前的準(zhǔn)備
系統(tǒng)版本:linux(版本centos6.5  64位系統(tǒng)) 64位操作系統(tǒng) ;

下載好 MySQL  MySQL-5.6.31-1.linux_glibc2.5.x86_64.rpm-bundle.tar
mysql  下載官網(wǎng):http://dev.mysql.com/downloads/file/?id=463181
2 下載后解壓在你自己新建的文件夾:我的放在 mysql 文件夾下
[root@localhost mysql]# tar -ivh MySQL-5.6.31-1.linux_glibc2.5.x86_64.rpm-bundle.tar 

3 開始安裝
a 檢查MySQL及相關(guān)RPM包,是否安裝,如果有安裝,
則移除(rpm –e 名稱 或 yum  -y remove 名稱)
[root@localhost mysql]# rpm -qa |grep -i mysql     ##  -i是不區(qū)分大小寫
MySQL-client-5.6.31-1.linux_glibc2.5.x86_64
MySQL-server-5.6.31-1.linux_glibc2.5.x86_64
[root@localhost mysql]# rpm -e MySQL-client-5.6.31-1.linux_glibc2.5.x86_64    ## 兩種移除方法都可以
[root@localhost mysql]# rpm -qa |grep -i mysql    
MySQL-server-5.6.31-1.linux_glibc2.5.x86_64
[root@localhost mysql]# yum -y remove MySQL-server-5.6.31-1.linux_glibc2.5.x86_64
Loaded plugins: fastestmirror, refresh-packagekit, security
Setting up Remove Process
Resolving Dependencies
--> Running transaction check
---> Package MySQL-server.x86_64 0:5.6.31-1.linux_glibc2.5 will be erased
--> Finished Dependency Resolution
........
Removed:
  MySQL-server.x86_64 0:5.6.31-1.linux_glibc2.5                                                                   
Complete!

接下來安裝服務(wù)端 和客戶端:用 yum  -y install 方式
1 先查看文件的詳細(xì)信息
[root@localhost mysql]# ls -l
總用量 623100
-rw-r--r--. 1 7155 31415  23624679 5月  18 22:13 MySQL-client-5.6.31-1.linux_glibc2.5.x86_64.rpm
-rw-r--r--. 1 7155 31415   4588279 5月  18 22:14 MySQL-devel-5.6.31-1.linux_glibc2.5.x86_64.rpm
-rw-r--r--. 1 7155 31415 117877215 5月  18 22:14 MySQL-embedded-5.6.31-1.linux_glibc2.5.x86_64.rpm
-rw-r--r--. 1 7155 31415  89759062 5月  18 22:15 MySQL-server-5.6.31-1.linux_glibc2.5.x86_64.rpm
-rw-r--r--. 1 7155 31415   2424499 5月  18 22:15 MySQL-shared-5.6.31-1.linux_glibc2.5.x86_64.rpm
-rw-r--r--. 1 7155 31415   5181145 5月  18 22:15 MySQL-shared-compat-5.6.31-1.linux_glibc2.5.x86_64.rpm
-rw-r--r--. 1 7155 31415  75560152 5月  18 22:15 MySQL-test-5.6.31-1.linux_glibc2.5.x86_64.rpm
[root@localhost mysql]# 
我們只要安裝紅色的兩個(gè)地方即可:
安裝服務(wù)端:
[root@localhost mysql]# yum -y install MySQL-server-5.6.31-1.linux_glibc2.5.x86_64.rpm
Loaded plugins: fastestmirror, refresh-packagekit, security
Loading mirror speeds from cached hostfile

................
Installed:
  MySQL-server.x86_64 0:5.6.31-1.linux_glibc2.5                                 
Complete

安裝完畢后啟動(dòng)服務(wù):
[root@localhost mysql]# /etc/init.d/mysql start
Starting MySQL........ SUCCESS! 

(ps:假如你在這邊啟動(dòng)服務(wù)的時(shí)候,出現(xiàn)報(bào)錯(cuò):比如你mysql 是卸載掉后重新安裝mysql的話,有可能會(huì)報(bào)這個(gè)錯(cuò):Starting MySQL........................................................................................................ ERROR! The server quit without updating PID file (/var/lib/mysql/localhost.localdomain.pid).  這是你之前卸載的mysql localhost.localdomain.pid  進(jìn)程沒有殺干凈,此時(shí)你可以先查看你進(jìn)程號(hào):ps -ef|grep -i mysqld 然后找到進(jìn)程強(qiáng)制殺死 如下:
[root@localhost mysql]# ps -ef|grep -i mysqld
root      3643     1  0 13:48 pts/0    00:00:00 /bin/sh /usr/bin/mysqld_safe --datadir=/var/lib/mysql --pid-file=/var/lib/mysql/localhost.localdomain.pid
mysql     3756  3643  1 13:48 pts/0    00:00:38 /usr/sbin/mysqld --basedir=/usr --datadir=/var/lib/mysql --plugin-dir=/usr/lib64/mysql/plugin --user=mysql --log-error=/var/lib/mysql/localhost.localdomain.err --pid-file=/var/lib/mysql/localhost.localdomain.pid
root      5023     1  0 14:48 pts/0    00:00:00 /bin/sh /usr/bin/mysqld_safe --datadir=/var/lib/mysql --pid-file=/var/lib/mysql/localhost.localdomain.pid
mysql     5136  5023  6 14:48 pts/0    00:00:04 /usr/sbin/mysqld --basedir=/usr --datadir=/var/lib/mysql --plugin-dir=/usr/lib64/mysql/plugin --user=mysql --log-error=/var/lib/mysql/localhost.localdomain.err --pid-file=/var/lib/mysql/localhost.localdomain.pid
root      5282  2384  0 14:49 pts/0    00:00:00 grep -i mysqld
[root@localhost mysql]# kill -9 3756            ##  5136  3756 的要是殺了沒效果5136 的殺掉
[root@localhost mysql]# /etc/init.d/mysql start
Starting MySQL.......... SUCCESS!

[root@localhost mysql]# 
查看 yum  安裝后的默認(rèn)密碼:
[root@localhost mysql]# cat /root/.mysql_secret
# The random password set for the root user at Sun Jul 24 12:14:33 2016 (local time): PwEYW3GrS6Yn1kp2

接下來安裝客戶端
[root@localhost mysql]# yum -y install MySQL-client-5.6.31-1.linux_glibc2.5.x86_64.rpm
Loaded plugins: fastestmirror, refresh-packagekit, security
......................
Installed:
  MySQL-client.x86_64 0:5.6.31-1.linux_glibc2.5                                                                   
Complete!

[root@localhost mysql]# rpm -qa |grep -i mysql
MySQL-client-5.6.31-1.linux_glibc2.5.x86_64
MySQL-server-5.6.31-1.linux_glibc2.5.x86_64
[root@localhost mysql]# 
此時(shí) 可以看到服務(wù)端客戶端都安裝好了,現(xiàn)在開始登陸
這邊登陸之前說明下,如果你是之前下已經(jīng)安裝過mysql ,并且是修改過隨機(jī)密碼 :PwEYW3GrS6Yn1kp2(每個(gè)人的隨機(jī)密碼不一樣哈) 然后再重新安裝的話 ,你這時(shí)候再cat /root/.mysql_secret 雖然還會(huì)是 PwEYW3GrS6Yn1kp2 這個(gè),但是這時(shí)候,我們登陸mysql:
mysql -uroot -hlocalhost -p
[root@localhost ~]# mysql -uroot -hlocalhost -p
Enter password: 
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
[root@localhost ~]# 
會(huì)出現(xiàn)這個(gè)錯(cuò)誤,就是登陸不了,因?yàn)檫@時(shí)候密碼不是這個(gè)了,而是你之前修改的過得密碼,我這邊還不知道是什么原因,總之我用卸載之前用的密碼重新登陸,就登陸成功了:

[root@localhost ~]# mysql -uroot -hlocalhost -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 5
Server version: 5.6.31 MySQL Community Server (GPL)
..........................................
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql>  
可能是有些地方?jīng)]有完全卸載干凈吧,導(dǎo)致記錄了之前的用戶信息。這個(gè)以后再查證

假如你是之前這個(gè)系統(tǒng)重來還沒安裝過 mysql ,那么你登陸后,輸入隨機(jī)密碼,就會(huì)登陸成功,成功查看數(shù)據(jù)庫 
mysql> show databases; ERROR 1820 (HY000): You must SET PASSWORD before executing this statement

mysql> set password=password('123456'); Query OK, 0 rows affected (0.00 sec) mysql> show databases; +--------------------+ | Database           | +--------------------+ | information_schema | | mysql              | | performance_schema | | test               | +--------------------+
4 rows in set (0.00 sec)
mysql> use mysql
Database changed
mysql> 

上述就是小編為大家分享的linux下安裝MySQL-5.6.31采用yum -y install 命令安裝的示例分析了,如果剛好有類似的疑惑,不妨參照上述分析進(jìn)行理解。如果想知道更多相關(guān)知識(shí),歡迎關(guān)注創(chuàng)新互聯(lián)行業(yè)資訊頻道。

當(dāng)前標(biāo)題:linux下安裝MySQL-5.6.31采用yum-yinstall命令安裝的示例分析
當(dāng)前地址:http://muchs.cn/article6/jopoig.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供網(wǎng)站維護(hù)、商城網(wǎng)站企業(yè)建站、網(wǎng)站排名、定制網(wǎng)站、網(wǎng)站收錄

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來源: 創(chuàng)新互聯(lián)

成都做網(wǎng)站