CentOS 6.8下安装MySQL 5.6.33

时间:2020-12-24 07:51:43

此处操作,包含MySQL的客户端及服务端。

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

 MySQL-5.6.-.linux_glibc2..x86_64.rpm-bundle.tar

下载到本地,将其解压,得到如下文件:

 -rw-r--r--.      Aug  : MySQL-client-5.6.-.linux_glibc2..x86_64.rpm
-rw-r--r--. Aug : MySQL-devel-5.6.-.linux_glibc2..x86_64.rpm
-rw-r--r--. Aug : MySQL-embedded-5.6.-.linux_glibc2..x86_64.rpm
-rw-r--r--. Aug : MySQL-server-5.6.-.linux_glibc2..x86_64.rpm
-rw-r--r--. Aug : MySQL-shared-5.6.-.linux_glibc2..x86_64.rpm
-rw-r--r--. Aug : MySQL-shared-compat-5.6.-.linux_glibc2..x86_64.rpm
-rw-r--r--. Aug : MySQL-test-5.6.-.linux_glibc2..x86_64.rpm

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

在安装之前,最好要执行一下检测当前系统是否安装有其他版本的MySQL,否则安装过程中会出现安装包中的插件和已经安装的插件有冲突,something confilcts with exiting 巴拉巴拉。。。。。

 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。

 chown -R mysql:mysql /var/lib/mysql                #这一步是绝对的重点,不要忘记,若启动mysql daemon出错,需要检查下权限问题。

否则,启动mysqld是会失败的。。。。

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

调查问题啊,由于mysql的默认配置情况下,错误日志是在basedir下面,文件名为$HOSTNAME.err,查看文件,既可以看到错误的详情内容。

 [root@CloudGame mysql]# ll
total
-rw-rw----. mysql mysql Sep : auto.cnf
-rw-r-----. mysql mysql Sep : CloudGame.err
-rw-r-----. mysql mysql Sep : CloudGame.err-bk
-rw-rw----. mysql mysql Sep : ibdata1
-rw-rw----. mysql mysql Sep : ib_logfile0
-rw-rw----. mysql mysql Sep : ib_logfile1
drwx------. mysql mysql Sep : mysql
drwx------. mysql mysql Sep : performance_schema
drwx------. mysql mysql Sep : test
[root@CloudGame mysql]# pwd
/var/lib/mysql

初始安装的数据库是没有root密码的,即root用户不需要密码即可登录。当MySQL daemon启动的情况下,可以执行mysql_secure_installnation可以设置一下数据库的基本信息。

 [root@CloudGame bin]# mysql_secure_installation 

 NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQL
SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY! In order to log into MySQL to secure it, we'll need the current
password for the root user. If you've just installed MySQL, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here. Enter current password for root (enter for none):
OK, successfully used password, moving on... Setting the root password ensures that nobody can log into the MySQL
root user without the proper authorisation. Set root password? [Y/n] y
New password:
Re-enter new password:
Password updated successfully!
Reloading privilege tables..
... Success! By default, a MySQL installation has an anonymous user, allowing anyone
to log into MySQL without having to have a user account created for
them. This is intended only for testing, and to make the installation
go a bit smoother. You should remove them before moving into a
production environment. Remove anonymous users? [Y/n] y
... Success! Normally, root should only be allowed to connect from 'localhost'. This
ensures that someone cannot guess at the root password from the network. Disallow root login remotely? [Y/n] n
... skipping. By default, MySQL comes with a database named 'test' that anyone can
access. This is also intended only for testing, and should be removed
before moving into a production environment. Remove test database and access to it? [Y/n] n
... skipping. Reloading the privilege tables will ensure that all changes made so far
will take effect immediately. Reload privilege tables now? [Y/n] n
... skipping. All done! If you've completed all of the above steps, your MySQL
installation should now be secure. Thanks for using MySQL! Cleaning up...
[root@CloudGame bin]#

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