一、下載並解壓
$ wget http://cdn.mysql.com/Downloads/MySQL-5.5/MySQL-5.5.42-1.el6.x86_64.rpm-bundle.tar
解壓後得到以下幾個文件:
$ tar -xvf MySQL-5.5.42-1.el6.x86_64.rpm-bundle.tar
MySQL-shared-5.5.42-1.el6.x86_64.rpm
MySQL-shared-compat-5.5.42-1.el6.x86_64.rpm
MySQL-server-5.5.42-1.el6.x86_64.rpm
MySQL-devel-5.5.42-1.el6.x86_64.rpm
MySQL-test-5.5.42-1.el6.x86_64.rpm
MySQL-client-5.5.42-1.el6.x86_64.rpm
MySQL-embedded-5.5.42-1.el6.x86_64.rpm
二、安裝
1、安裝server
(1)# rpm -ivh MySQL-server-5.5.42-1.el6.x86_64.rpm
(2)若出現沖突錯誤,則是由於linux可能自帶了mysql的庫,需要先將之刪除
# rpm -e mysql-libs.x86_64 --nodeps
2、安裝client
# rpm -ivh MySQL-client-5.5.42-1.el6.x86_64.rpm
三、關於配置文件
# ls *.cnf my-huge.cnf my-innodb-heavy-4G.cnf my-large.cnf my-medium.cnf my-small.cnf # pwd /usr/share/mysql
使用rpm方法進行安裝時,配置文件放在/usr/share/mysql中,可根據需要放到其它地方。
四、啟動及關閉
1、方式一:命令行方式
# mysqld_safe & # mysqladmin -uroot shutdown
2、方式二:服務方式
# service mysql start # service mysql stop # service mysql restart
3、連接數據庫開始使用
# mysql -u root -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 1 Server version: 5.5.42 MySQL Community Server (GPL) Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql>