CentOS 6.8下安裝MySQL 5.6.33


此處操作,包含MySQL的客戶端及服務端。

 

MySQL下載地址: http://dev.mysql.com/downloads/mysql/5.6.html

1 MySQL-5.6.33-1.linux_glibc2.5.x86_64.rpm-bundle.tar

 

下載到本地,將其解壓,得到如下文件:

1 -rw-r--r--. 1 7155 31415  23514633 Aug 29 18:11 MySQL-client-5.6.33-1.linux_glibc2.5.x86_64.rpm
2 -rw-r--r--. 1 7155 31415   4593511 Aug 29 18:11 MySQL-devel-5.6.33-1.linux_glibc2.5.x86_64.rpm
3 -rw-r--r--. 1 7155 31415 117878328 Aug 29 18:11 MySQL-embedded-5.6.33-1.linux_glibc2.5.x86_64.rpm
4 -rw-r--r--. 1 7155 31415  89757099 Aug 29 18:12 MySQL-server-5.6.33-1.linux_glibc2.5.x86_64.rpm
5 -rw-r--r--. 1 7155 31415   2424746 Aug 29 18:12 MySQL-shared-5.6.33-1.linux_glibc2.5.x86_64.rpm
6 -rw-r--r--. 1 7155 31415   5181146 Aug 29 18:12 MySQL-shared-compat-5.6.33-1.linux_glibc2.5.x86_64.rpm
7 -rw-r--r--. 1 7155 31415  75564628 Aug 29 18:13 MySQL-test-5.6.33-1.linux_glibc2.5.x86_64.rpm

其中,用到的部分,只有client以及server兩個文件。

 

在安裝之前,最好要執行一下檢測當前系統是否安裝有其他版本的MySQL,否則安裝過程中會出現安裝包中的插件和已經安裝的插件有沖突,something confilcts with exiting 巴拉巴拉。。。。。

1 rpm -qa | grep -i mysql

 

rpm安裝程序很簡單,就不多說.
安裝后的程序,客戶端mysql在/usr/bin下面,服務端在/usr/sbin/下面。mysql的安裝腳本會被copy到/etc/init.d/目錄下。最簡單的事情,什么都不修改,用默認的配置,則mysql的配置項目datadir是在

此處操作,包含MySQL的客戶端及服務端。

 

MySQL下載地址: http://dev.mysql.com/downloads/mysql/5.6.html

1 MySQL-5.6.33-1.linux_glibc2.5.x86_64.rpm-bundle.tar

 

下載到本地,將其解壓,得到如下文件:

1 -rw-r--r--. 1 7155 31415 23514633 Aug 29 18:11 MySQL-client-5.6.33-1.linux_glibc2.5.x86_64.rpm 2 -rw-r--r--. 1 7155 31415 4593511 Aug 29 18:11 MySQL-devel-5.6.33-1.linux_glibc2.5.x86_64.rpm 3 -rw-r--r--. 1 7155 31415 117878328 Aug 29 18:11 MySQL-embedded-5.6.33-1.linux_glibc2.5.x86_64.rpm 4 -rw-r--r--. 1 7155 31415 89757099 Aug 29 18:12 MySQL-server-5.6.33-1.linux_glibc2.5.x86_64.rpm 5 -rw-r--r--. 1 7155 31415 2424746 Aug 29 18:12 MySQL-shared-5.6.33-1.linux_glibc2.5.x86_64.rpm 6 -rw-r--r--. 1 7155 31415 5181146 Aug 29 18:12 MySQL-shared-compat-5.6.33-1.linux_glibc2.5.x86_64.rpm 7 -rw-r--r--. 1 7155 31415 75564628 Aug 29 18:13 MySQL-test-5.6.33-1.linux_glibc2.5.x86_64.rpm

其中,用到的部分,只有client以及server兩個文件。

 

在安裝之前,最好要執行一下檢測當前系統是否安裝有其他版本的MySQL,否則安裝過程中會出現安裝包中的插件和已經安裝的插件有沖突,something confilcts with exiting 巴拉巴拉。。。。。

1 rpm -qa | grep -i mysql

 

rpm安裝程序很簡單,就不多說.
安裝后的程序,客戶端mysql在/usr/bin下面,服務端在/usr/sbin/下面。mysql的安裝腳本會被copy到/etc/init.d/目錄下。最簡單的事情,什么都不修改,用默認的配置,則mysql的配置項目basedir是在/var/lib/mysql下面。

現在,需要注意了,MySQL的datadir需要設置mysql的用戶owner以及group。

1 chown -R mysql:mysql /var/lib/mysql                #這一步是絕對的重點,不要忘記,若啟動mysql daemon出錯,需要檢查下權限問題。

 

否則,啟動mysqld是會失敗的。。。。

1 [root@CloudGame bin]# service mysql start
2 Starting MySQL.The server quit without updating PID file (/[FAILED]mysql/CloudGame.pid).

調查問題啊,由於mysql的默認配置情況下,錯誤日志是在basedir下面,文件名為$HOSTNAME.err,查看文件,既可以看到錯誤的詳情內容。

 1 [root@CloudGame mysql]# ll
 2 total 110632
 3 -rw-rw----. 1 mysql mysql       56 Sep 23 16:51 auto.cnf
 4 -rw-r-----. 1 mysql mysql    17672 Sep 23 17:29 CloudGame.err
 5 -rw-r-----. 1 mysql mysql     3275 Sep 23 16:52 CloudGame.err-bk
 6 -rw-rw----. 1 mysql mysql 12582912 Sep 23 17:07 ibdata1
 7 -rw-rw----. 1 mysql mysql 50331648 Sep 23 17:29 ib_logfile0
 8 -rw-rw----. 1 mysql mysql 50331648 Sep 23 16:51 ib_logfile1
 9 drwx------. 2 mysql mysql     4096 Sep 23 16:55 mysql
10 drwx------. 2 mysql mysql     4096 Sep 23 16:55 performance_schema
11 drwx------. 2 mysql mysql     4096 Sep 23 16:55 test
12 [root@CloudGame mysql]# pwd
13 /var/lib/mysql

 

初始安裝的數據庫是沒有root密碼的,即root用戶不需要密碼即可登錄。當MySQL daemon啟動的情況下,可以執行mysql_secure_installnation可以設置一下數據庫的基本信息。

 1 [root@CloudGame bin]# mysql_secure_installation 
 2 
 3 
 4 
 5 NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQL
 6       SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!
 7 
 8 In order to log into MySQL to secure it, we'll need the current
 9 password for the root user.  If you've just installed MySQL, and
10 you haven't set the root password yet, the password will be blank,
11 so you should just press enter here.
12 
13 Enter current password for root (enter for none): 
14 OK, successfully used password, moving on...
15 
16 Setting the root password ensures that nobody can log into the MySQL
17 root user without the proper authorisation.
18 
19 Set root password? [Y/n] y
20 New password: 
21 Re-enter new password: 
22 Password updated successfully!
23 Reloading privilege tables..
24  ... Success!
25 
26 
27 By default, a MySQL installation has an anonymous user, allowing anyone
28 to log into MySQL without having to have a user account created for
29 them.  This is intended only for testing, and to make the installation
30 go a bit smoother.  You should remove them before moving into a
31 production environment.
32 
33 Remove anonymous users? [Y/n] y 
34  ... Success!
35 
36 Normally, root should only be allowed to connect from 'localhost'.  This
37 ensures that someone cannot guess at the root password from the network.
38 
39 Disallow root login remotely? [Y/n] n
40  ... skipping.
41 
42 By default, MySQL comes with a database named 'test' that anyone can
43 access.  This is also intended only for testing, and should be removed
44 before moving into a production environment.
45 
46 Remove test database and access to it? [Y/n] n
47  ... skipping.
48 
49 Reloading the privilege tables will ensure that all changes made so far
50 will take effect immediately.
51 
52 Reload privilege tables now? [Y/n] n
53  ... skipping.
54 
55 
56 
57 
58 All done!  If you've completed all of the above steps, your MySQL
59 installation should now be secure.
60 
61 Thanks for using MySQL!
62 
63 
64 Cleaning up...
65 [root@CloudGame bin]#

 

OK,到此,MYSQL 5.6.33的安裝結束。 即可正常使用了!


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM