標籤:name acl listen iat title rpo host evel chkconfig
1、用yum安裝
用root許可權開啟命令列介面,執行以下yum指令:
yum安裝MySQL
yum install mysql mysql-server mysql-devel -y |
在最終提示Complete!表示安裝成功。
2、確認MySQL服務端已啟動
安裝完畢後,查看是否產生了mysqld服務——即MySQL的服務端。如果不是自動啟動的話,可以設定為自動啟動:
啟動服務端
[[email protected] ~]# chkconfig --list|grep mysqlmysqld 0:off 1:off 2:off 3:off 4:off 5:off 6:off[[email protected] ~]# chkconfig mysqld on[[email protected] ~]# chkconfig --list|grep mysqlmysqld 0:off 1:off 2:on 3:on 4:on 5:on 6:off |
也可以直接用service指令啟動服務。
3、MySQL目錄
通過yum安裝MySQL後,預設目錄為“/var/lib/mysql”,進入目錄:
MySQL目錄
[[email protected] mysql]# pwd/var/lib/mysql[[email protected] mysql]# lltotal 20488-rw-rw---- 1 mysql mysql 10485760 Jul 13 06:21 ibdata1-rw-rw---- 1 mysql mysql 5242880 Jul 13 06:21 ib_logfile0-rw-rw---- 1 mysql mysql 5242880 Jul 13 06:21 ib_logfile1drwx------ 2 mysql mysql 4096 Jul 13 06:21 mysqlsrwxrwxrwx 1 mysql mysql 0 Jul 13 06:21 mysql.sockdrwx------ 2 mysql mysql 4096 Jul 13 06:21 test |
發現有兩個庫,都是mysql預設內建的。
4、查看連接埠
連接埠
[[email protected] mysql]# netstat -nultp|grep mysqltcp 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN 15086/mysqld |
MySQL預設佔用3306連接埠
5、命令列串連MySQL
直接執行,yum安裝的mysql,本地root密碼預設為空白。
串連MySQL
[[email protected] mysql]# mysqlWelcome to the MySQL monitor. Commands end with ; or \g.Your MySQL connection id is 2Server version: 5.1.71 Source distribution Copyright (c) 2000, 2013, 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> |
6、設定初始密碼和許可權
設定新密碼並授予許可權,重新整理許可權使之生效:(例密碼設定為“123456”)
設定許可權
mysql> grant all on *.* to [email protected]‘%‘ identified by ‘123456‘;Query OK, 0 rows affected (0.00 sec) mysql> flush privileges;Query OK, 0 rows affected (0.00 sec) mysql> exit;Bye |
MySQL資料庫安裝與啟動(Linux)