另外一種善後處理:卸載後 /var/lib/mysql 中的 /etc/my.cnf 會重命名爲 my.cnf.rpmsave,/var/log/mysqld.log 會重命名爲 /var/log/mysqld.log.rpmsave,若是肯定沒用後就手工刪除。
rpm -ivh MySQL-server-5.6.22-1.linux_glibc2.5.x86_64.rpm
Preparing... ########################################### [100%]
1:MySQL-server ########################################### [100%]
warning: user mysql does not exist - using root
warning: group mysql does not exist - using root
2014-08-10 22:43:44 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2014-08-10 22:43:44 23012 [Note] InnoDB: Using atomics to ref count buffer pool pages
2014-08-10 22:43:44 23012 [Note] InnoDB: The InnoDB memory heap is disabled
2014-08-10 22:43:44 23012 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2014-08-10 22:43:44 23012 [Note] InnoDB: Memory barrier is not used
2014-08-10 22:43:44 23012 [Note] InnoDB: Compressed tables use zlib 1.2.3
2014-08-10 22:43:44 23012 [Note] InnoDB: Using Linux native AIO
2014-08-10 22:43:44 23012 [Note] InnoDB: Not using CPU crc32 instructions
2014-08-10 22:43:44 23012 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2014-08-10 22:43:44 23012 [Note] InnoDB: Completed initialization of buffer pool
2014-08-10 22:43:45 23012 [Note] InnoDB: The first specified data file ./ibdata1 did not exist: a new database to be created!
2014-08-10 22:43:45 23012 [Note] InnoDB: Setting file ./ibdata1 size to 12 MB
2014-08-10 22:43:45 23012 [Note] InnoDB: Database physically writes the file full: wait...
2014-08-10 22:43:45 23012 [Note] InnoDB: Setting log file ./ib_logfile101 size to 48 MB
2014-08-10 22:43:46 23012 [Note] InnoDB: Setting log file ./ib_logfile1 size to 48 MB
2014-08-10 22:43:46 23012 [Note] InnoDB: Renaming log file ./ib_logfile101 to ./ib_logfile0
2014-08-10 22:43:46 23012 [Warning] InnoDB: New log files created, LSN=45781
2014-08-10 22:43:46 23012 [Note] InnoDB: Doublewrite buffer not found: creating new
2014-08-10 22:43:46 23012 [Note] InnoDB: Doublewrite buffer created
2014-08-10 22:43:46 23012 [Note] InnoDB: 128 rollback segment(s) are active.
2014-08-10 22:43:46 23012 [Warning] InnoDB: Creating foreign key constraint system tables.
2014-08-10 22:43:47 23012 [Note] InnoDB: Foreign key constraint system tables created
2014-08-10 22:43:47 23012 [Note] InnoDB: Creating tablespace and datafile system tables.
2014-08-10 22:43:47 23012 [Note] InnoDB: Tablespace and datafile system tables created.
2014-08-10 22:43:47 23012 [Note] InnoDB: Waiting for purge to start
2014-08-10 22:43:47 23012 [Note] InnoDB: 5.6.22 started; log sequence number 0
A random root password has been set. You will find it in '/root/.mysql_secret'.
2014-08-10 22:43:48 23012 [Note] Binlog end
2014-08-10 22:43:48 23012 [Note] InnoDB: FTS optimize thread exiting.
2014-08-10 22:43:48 23012 [Note] InnoDB: Starting shutdown...
2014-08-10 22:43:50 23012 [Note] InnoDB: Shutdown completed; log sequence number 1625977
2014-08-10 22:43:50 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2014-08-10 22:43:50 23039 [Note] InnoDB: Using atomics to ref count buffer pool pages
2014-08-10 22:43:50 23039 [Note] InnoDB: The InnoDB memory heap is disabled
2014-08-10 22:43:50 23039 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2014-08-10 22:43:50 23039 [Note] InnoDB: Memory barrier is not used
2014-08-10 22:43:50 23039 [Note] InnoDB: Compressed tables use zlib 1.2.3
2014-08-10 22:43:50 23039 [Note] InnoDB: Using Linux native AIO
2014-08-10 22:43:50 23039 [Note] InnoDB: Not using CPU crc32 instructions
2014-08-10 22:43:50 23039 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2014-08-10 22:43:50 23039 [Note] InnoDB: Completed initialization of buffer pool
2014-08-10 22:43:50 23039 [Note] InnoDB: Highest supported file format is Barracuda.
2014-08-10 22:43:50 23039 [Note] InnoDB: 128 rollback segment(s) are active.
2014-08-10 22:43:50 23039 [Note] InnoDB: Waiting for purge to start
2014-08-10 22:43:50 23039 [Note] InnoDB: 5.6.22 started; log sequence number 1625977
2014-08-10 22:43:50 23039 [Note] Binlog end
2014-08-10 22:43:50 23039 [Note] InnoDB: FTS optimize thread exiting.
2014-08-10 22:43:50 23039 [Note] InnoDB: Starting shutdown...
2014-08-10 22:43:52 23039 [Note] InnoDB: Shutdown completed; log sequence number 1625987
A RANDOM PASSWORD HAS BEEN SET FOR THE MySQL root USER !
You will find that password in '/root/.mysql_secret'.
You must change that password on your first connect,
no other statement but 'SET PASSWORD' will be accepted.
See the manual for the semantics of the 'password expired' flag.
Also, the account for the anonymous user has been removed.
In addition, you can run:
/usr/bin/mysql_secure_installation
which will also give you the option of removing the test database.
This is strongly recommended for production servers.
See the manual for more instructions.
Please report any problems at
http://bugs.mysql.com/
The latest information about MySQL is available on the web at
http://www.mysql.com
Support MySQL by buying support/licenses at
http://shop.mysql.com
New default config file was created as /usr/my.cnf and
will be used by default by the server when you start it.
You may edit this file to change server settings
3)檢測 MySQL 3306 端口是否安打開。測試是否成功可運行 netstat 看 MySQL 端口是否打開,如打開表示服務已經啓動,安裝成功。MySQL 默認的端口是3306。
[
root@hadoop Mysql]# netstat -nat
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address Foreign Address State
tcp 0 0 0.0.0.0:50070 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN
tcp 0 0 127.0.0.1:631 0.0.0.0:* LISTEN
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:50010 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:50075 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:50020 0.0.0.0:* LISTEN
tcp 0 0 192.168.128.129:9000 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:50090 0.0.0.0:* LISTEN
tcp 1 0 192.168.128.129:35744 63.130.76.64:80 CLOSE_WAIT
tcp 0 0 192.168.128.129:34847 192.168.128.129:9000 ESTABLISHED
tcp 0 0 192.168.128.129:35770 192.168.128.129:9000 TIME_WAIT
tcp 0 52 192.168.128.129:22 192.168.128.1:1297 ESTABLISHED
tcp 0 0 192.168.128.129:50968 61.135.185.247:80 ESTABLISHED
tcp 0 0 192.168.128.129:9000 192.168.128.129:34847 ESTABLISHED
tcp 0 0 :::34803 :::* LISTEN
tcp 0 0 :::22 :::* LISTEN
tcp 0 0 ::1:631 :::* LISTEN
tcp 0 0 :::8088 :::* LISTEN
tcp 0 0 :::13562 :::* LISTEN
tcp 0 0 :::8030 :::* LISTEN
tcp 0 0 :::8031 :::* LISTEN
tcp 0 0 :::8032 :::* LISTEN
tcp 0 0 :::8033 :::* LISTEN
tcp 0 0 :::8040 :::* LISTEN
tcp 0 0 :::8042 :::* LISTEN
tcp 0 0 ::ffff:192.168.128.129:8031 ::ffff:192.168.128.12:58051 ESTABLISHED
tcp 0 0 ::ffff:192.168.128.12:58051 ::ffff:192.168.128.129:8031 ESTABLISHED
Preparing... ########################################### [100%]
1:MySQL-client ^C########################################### [100%] 安裝完成
MySQL安裝完成後不像 SQL Server 默認安裝在一個目錄,它的數據庫文件、配置文件和命令文件分別在不一樣的目錄,瞭解這些目錄很是重要,尤爲對於Linux的初學者,由於 Linux自己的目錄結構就比較複雜,若是搞不清楚MySQL的安裝目錄那就無從談起深刻學習。
6)更改 MySQL 目錄。因爲MySQL數據庫目錄佔用磁盤比較大,而MySQL默認的數據文件存儲目錄爲 /"var/lib/mysql",也能夠把要把數據目錄移到 "/" 根目錄下的 "mysql_data" 目錄中(若是作測試用就不用移動了)。
MySQL默認用戶名爲"root",此處的"root"與Linux的最高權限用戶"root"不是一下子,並且默認的用戶"root"的密碼爲空,因此上圖中讓輸入密碼,直接點擊回車便可。
若是"/etc/"目錄下沒有my.cnf配置文件,請到 "/usr/share/mysql/" 下找到 my-default.cnf 文件,拷貝其中一個合適的配置文件到 "/etc/" 並更名爲 "my.cnf" 中。命令以下: