標籤:star 安裝檔案 centos7 ase load 介面 unity ... cti
VMware虛擬機器裝好後,再裝個CentOS7系統,以上環境自行百度...
一、Linux下查看mysql是否安裝
1、指令ps -ef|grep mysql
[[email protected] 案頭]# ps -ef|grep mysqlmysql 2688 1 0 13:31 ? 00:00:00 /bin/sh /usr/bin/mysqld_safe --basedir=/usrmysql 2857 2688 0 13:31 ? 00:00:01 /usr/sbin/mysqld --basedir=/usr --datadir=/var/lib/mysql --plugin-dir=/usr/lib64/mysql/plugin --log-error=/var/log/mysqld.log --pid-file=/var/run/mysqld/mysqld.pid --socket=/var/lib/mysql/mysql.sockroot 4326 4294 0 13:39 pts/0 00:00:00 grep --color=auto mysql/
2、rpm -qa | grep mysql
[[email protected] 案頭]# rpm -qa | grep mysqlmysql-community-libs-5.6.36-2.el7.x86_64mysql-community-release-el7-5.noarchmysql-community-server-5.6.36-2.el7.x86_64mysql-community-client-5.6.36-2.el7.x86_64mysql-community-devel-5.6.36-2.el7.x86_64mysql-community-common-5.6.36-2.el7.x86_64
3、mysql的守護進程是mysqld
如果已經安裝:
[[email protected] 案頭]# service mysqld start Redirecting to /bin/systemctl start mysqld.service
如果沒有安裝:
[[email protected] 案頭]# service mysqld start
mysqld:未被識別的服務
二、如果沒有安裝過mysql
centos7不支援mysql,內部整合了mariadb,而安裝mysql的話會和mariadb檔案衝突,所以需要先卸載mariadb,以下為卸載mariadb,安裝mysql的步驟
#列出所有被安裝的rpm package rpm -qa | grep mariadb#卸載rpm -e mariadb-libs-5.5.37-1.el7_0.x86_64
1、下載mysql的repo源 , http://download.csdn.net/detail/xuxiaoyu__/9890496,把這個安裝檔案拖到linux可視化介面上,
2、安裝rpm包,執行安裝命令:
[[email protected] 案頭]# rpm -ivh ‘/home/xuxiaoyu/案頭/mysql-community-release-el7-5.noarch.rpm‘ (斷行符號)
準備中... ################################# [100%]
軟體包 mysql-community-release-el7-5.noarch 已經安裝
3、安裝myslq:yum install mysql-server(如果不成功,就操作步驟4)
4、使用yum安裝mysql資料庫(在操作之前我先執行了這個命令,因為剛開始裝mysql時,各種錯,就按著網上說的去試了 yum install -y perl perl-devela)
輸入:yum -y install mysql-server mysql mysql-devel ,命令將:mysql-server、mysql、mysql-devel都安裝好,當結果顯示為“Complete!”即安裝完畢。
註:安裝mysql只是安裝了資料庫,只有安裝mysql-server才相當於安裝了用戶端。
三、安裝成功後對mysql的相關操作
啟動mysql:systemctl start mysqld.service
結束:systemctl stop mysqld.service
重啟:systemctl restart mysqld.service
串連mysql,進入mysql dos,一開始安裝是不要求輸入密碼的,斷行符號一下就行(輸入exit,斷行符號,退出mysql dos),出現以下頁面,說明mysql安裝成功,完全可以正常使用!
(參考:http://www.360doc.com/content/16/0617/21/8357485_568631202.shtml)
[[email protected] 案頭]# mysql -uroot -pEnter password: Welcome to the MySQL monitor. Commands end with ; or \g.Your MySQL connection id is 4Server version: 5.6.36 MySQL Community Server (GPL)Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.Oracle is a registered trademark of Oracle Corporation and/or itsaffiliates. Other names may be trademarks of their respectiveowners.Type ‘help;‘ or ‘\h‘ for help. Type ‘\c‘ to clear the current input statement.mysql>
四、其他:
1、殺掉yum進程:rm -f /var/run/yum.pid
2、ctrl+alt+F1/F2 虛擬機器可視化介面和dos命令相互切換
3、虛擬機器鎖屏時,直接輸入密碼即可解鎖
CentOS7 下安裝 mysql 涉及到的命令