1.首先我们需要安装带有可用的mysql5系列社区版资源的rpm包
因为centos自带的仓库是不会自动更新每个软件的最新版本的,所以无法通过yum方式安装mysql的高级版本
rpm -Uvh http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm
2.查询当前可用的mysql安装资源
yum repolist enabled | grep "mysql.*-community.*"
3.安装mysql服务
yum -y install mysql-community-server
4.关闭mysql大小写敏感问题
使用vim编辑器,在/etc/my.sql的[mysqld]节点下加入lower_case_table_names=1配置
# For advice on how to change settings please see# http://dev.mysql.com/doc/refman/5.6/en/server-configuration-defaults.html[mysqld]## Remove leading # and set to the amount of RAM for the most important data# cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.# innodb_buffer_pool_size = 128M## Remove leading # to turn on a very important data integrity option: logging# changes to the binary log between backups.# log_bin## Remove leading # to set options mainly useful for reporting servers.# The server defaults are faster for transactions and fast SELECTs.# Adjust sizes as needed, experiment to find the optimal values.# join_buffer_size = 128M# sort_buffer_size = 2M# read_rnd_buffer_size = 2Mdatadir=/var/lib/mysqlsocket=/var/lib/mysql/mysql.sock# 关闭大小写敏感lower_case_table_names=1# Disabling symbolic-links is recommended to prevent assorted security riskssymbolic-links=0# Recommended in standard MySQL setupsql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES[mysqld_safe]log-error=/var/log/mysqld.logpid-file=/var/run/mysqld/mysqld.pid
5.设置开机启动和启动mysql服务
#加入开机启动systemctl enable mysqld#启动mysql服务进程systemctl start mysqld
6.初始化,执行mysql_secure_installation命令
#会依次出现以下问题。Set root password? [Y/n]是否设置root用户的密码 (y。【设置登录密码】)Remove anonymous users? [Y/n]是否删除匿名用户 (y)Disallow root login remotely? [Y/n]是否禁止root远程登录 (n)Remove test database and access to it? [Y/n]是否删除test数据库(y)Reload privilege tables now? [Y/n]是否重新加载授权信息 (y)
7.开启远程访问
# 登陆mysqlmysql -uroot -p# 授权(root用户)远程连接权限(不建议)GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '远程登录密码' WITH GRANT OPTION;# 刷新权限FLUSH PRIVILEGES;
