公司需要安裝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方便很多)游沿,結(jié)果啟動超時,查看日志發(fā)現(xiàn)缺少了一張表,后來找到了對應(yīng)的解決方案(感謝安靜的技術(shù)控)
引用:https://blog.csdn.net/a2011480169/article/details/51912771
問題:在linux上安裝mysql的時候出現(xiàn)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服務(wù)后未玻,一般需要執(zhí)行數(shù)據(jù)庫初始化操作 尊惰,從而生成與權(quán)限相關(guān)的表憎乙,執(zhí)行命令如下:
/usr/bin/mysql_install_db --user=mysql
注:以上命令中的mysql_install_db與你安裝的mysql服務(wù)位置有關(guān)炭玫,如果不知道在哪卵凑,可以使用find / -name mysql_install_db找到其位置庆聘,然后執(zhí)行上面的命令。
[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...