centos7.2 安装mysql5.6

公司需要安装mysql5.6~~~~

安装

安装可用的5.6版本rpm包

rpm -Uvh http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm

查看当前可用的mysql安装资源

[root@bogon vagrant]# yum repolist enabled | grep "mysql.*-community.*"
mysql-connectors-community/x86_64 MySQL Connectors Community                  51
mysql-tools-community/x86_64      MySQL Tools Community                       63
mysql56-community/x86_64          MySQL 5.6 Community Server                 395

用yum安装

yum -y install mysql-community-server


配置

加入开机启动

systemctl enable mysqld

启动

systemctl start mysqld
原本以为安装成功之后能顺利启动(感觉ubuntu方便很多),结果启动超时,查看日志发现缺少了一张表,后来找到了对应的解决方案(感谢安静的技术控)

引用:https://blog.csdn.net/a2011480169/article/details/51912771

问题:在linux上安装mysql的时候出现Plugin ‘FEDERATED’ is disabled. 
/usr/sbin/mysqld: Table ‘mysql.plugin’ doesn’t exist问题。
[root@hadoop11 mysql]# more hadoop11.err
160714 14:51:30 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
160714 14:51:30 [Note] Plugin 'FEDERATED' is disabled.
/usr/sbin/mysqld: Table 'mysql.plugin' doesn't exist
160714 14:51:30 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
160714 14:51:30 InnoDB: The InnoDB memory heap is disabled
160714 14:51:30 InnoDB: Mutexes and rw_locks use GCC atomic builtins
160714 14:51:30 InnoDB: Compressed tables use zlib 1.2.3
160714 14:51:30 InnoDB: Using Linux native AIO
160714 14:51:30 InnoDB: Initializing buffer pool, size = 128.0M
160714 14:51:30 InnoDB: Completed initialization of buffer pool
InnoDB: The first specified data file ./ibdata1 did not exist:
InnoDB: a new database to be created!

原因: 
table ‘mysql.host’不存在的原因是因为新安装的mysql服务后,一般需要执行数据库初始化操作 ,从而生成与权限相关的表,执行命令如下:


/usr/bin/mysql_install_db --user=mysql

注:以上命令中的mysql_install_db与你安装的mysql服务位置有关,如果不知道在哪,可以使用find / -name mysql_install_db找到其位置,然后执行上面的命令。


[root@hadoop11 mysql]# find / -name mysql_install_db
/usr/bin/mysql_install_db

顺利解决问题!

初始化

[root@bogon vagrant]# 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): 
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
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] y
 - Dropping test database...
 ... Success!
 - Removing privileges on test database...
 ... Success!

Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.

Reload privilege tables now? [Y/n] y
 ... Success!




All done!  If you've completed all of the above steps, your MySQL
installation should now be secure.

Thanks for using MySQL!


Cleaning up...

你可能感兴趣的:(centos7.2 安装mysql5.6)