1.上传至目录或在服务器端下载mysql cd /opt/sudytech |
wget http://101.96.10.71/dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.16-linux-glibc2.5-x86_64.tar.gz
2.解压mysql-5.7.16-linux-glibc2.5-x86_64.tar.gz
tar -xzvf mysql-5.7.16-linux-glibc2.5-x86_64.tar.gz
tar -xzvf mysql-5.7.16-linux-glibc2.5-x86_64.tar.gz
3.更改mysql目录名称
mv mysql-5.7.16-linux-glibc2.5-x86_64.tar.gz mysql
mv mysql-5.7.16-linux-glibc2.5-x86_64.tar.gz mysql
4.将如下mysql配置文件保存至/etc/my.cnf
注:
thread_concurrency、innodb_thread_concurrency 对应服务器cpu线程数,可以调小,但不可过大
文中配置文件以8G内存为标准配置,实际内存等于或低于8G,请降低部分缓存参数
thread_concurrency
myisam_recover
innodb_file_io_threads
等设置涉及虚拟化和多线程,取决于cpu和系统是否支持,参照errorlog,如有报错,删除对应参数,此文档my.cnf为最大化配置项
thread_concurrency、innodb_thread_concurrency 对应服务器cpu线程数,可以调小,但不可过大
文中配置文件以8G内存为标准配置,实际内存等于或低于8G,请降低部分缓存参数
thread_concurrency
myisam_recover
innodb_file_io_threads
等设置涉及虚拟化和多线程,取决于cpu和系统是否支持,参照errorlog,如有报错,删除对应参数,此文档my.cnf为最大化配置项
5.建立非登录用户mysql
adduser -s /sbin/nologin mysql
makedir /opt/sudytech/mysql/data
chown mysql /opt/sudytech/mysql/data
adduser -s /sbin/nologin mysql
makedir /opt/sudytech/mysql/data
chown mysql /opt/sudytech/mysql/data
6.初始化mysql
cd /opt/sudytech/mysql
./bin/mysqld --initialize --user=mysql
cd /opt/sudytech/mysql
./bin/mysqld --initialize --user=mysql
7.查看mysql日志(/opt/sudytech/mysql/data/log-error.log),查看初始化密码
localhost: xxxxxxxxx
localhost: xxxxxxxxx
8.使用初始密码登录,grant赋予本地权限
/opt/sudytech/mysql/bin/mysqladmin -u root -p'xxxxx(步骤7密码)' password 'xxxxx(新密码)'
/opt/sudytech/mysql/bin/mysqladmin -u root -p'xxxxx(步骤7密码)' password 'xxxxx(新密码)'
9.使用secureinstall进行安全模块安装
/opt/sudytech/mysql/bin/mysql_secure_installation
根据提示进行设置:
a.是否部署密码复杂度检查模块(复杂度级别)
b.是否清除非管理员用户
c.是否允许管理员远程登录mysql
d.是否删除公共test库
/opt/sudytech/mysql/bin/mysql_secure_installation
根据提示进行设置:
a.是否部署密码复杂度检查模块(复杂度级别)
b.是否清除非管理员用户
c.是否允许管理员远程登录mysql
d.是否删除公共test库