centos 7.2 yum 安装 MySQL 社区版

1、新建yum源
[root@myhost yum.repos.d]# pwd
/etc/yum.repos.d

[root@myhost yum.repos.d]# cat mysql-community.repo

# Enable to use MySQL 5.6
[mysql56-community]
name=MySQL 5.6 Community Server
baseurl=http://repo.mysql.com/yum/mysql-5.6-community/el/7/x86_64
enabled=1
gpgcheck=0

2、yum 安装MySQL社区版

[root@myhost yum.repos.d]# yum install mysql-community-server
[root@myhost yum.repos.d]# systemctl list-unit-files | grep mysql
[root@myhost yum.repos.d]# service mysql start

3、解决告警
[root@myhost yum.repos.d]# cat /var/log/mysqld.log | grep Warning
问题

2016-12-05 15:13:29 9005 [Warning] Buffered warning: Changed limits: max_open_files: 1024 (requested 5000)
2016-12-05 15:13:29 9005 [Warning] Buffered warning: Changed limits: table_open_cache: 431 (requested 2000)

解决

[root@myhost ~]# ulimit -a
[root@myhost ~]# vi /etc/security/limits.conf

追加

mysql hard nofile 65535
mysql soft nofile 65535

[root@myhost ~]# vi /usr/lib/systemd/system/mysqld.service
(in the [service] section) 追加

LimitNOFILE=65535

[root@myhost ~]# systemctl daemon-reload
[root@myhost ~]# service mysql restart

see more: http://stackoverflow.com/questions/32760202/buffered-warning-changed-limits-max-connections-214-requested-800

4、重置root密码
# service mysql stop
# mysqld_safe –user=mysql –skip-grant-tables –skip-networking &
# mysql -u root mysql

mysql>UPDATE user SET Password=PASSWORD(‘new_password’) where USER=’root’;
mysql>FLUSH PRIVILEGES;
mysql>quit

# service mysql start

No Comments

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

粤ICP备15062915号-1