centos7+mysql5.7二进制安装
发表于:2025-01-23 作者:千家信息网编辑
千家信息网最后更新 2025年01月23日,一、优化部分1、操作系统参数调优2、数据库参数调优3、防火墙设置等二、安装部分1、创建用户和组# groupadd mysql# useradd -g mysql mysql2、到安装目录,解压安装文
千家信息网最后更新 2025年01月23日centos7+mysql5.7二进制安装
一、优化部分
1、操作系统参数调优
2、数据库参数调优
3、防火墙设置等
二、安装部分
1、创建用户和组
# groupadd mysql# useradd -g mysql mysql
2、到安装目录,解压安装文件
#cd /data#tar -zxvf mysql-5.7.19-linux-glibc2.12-x86_64.tar.gz#mv mysql-5.7.19-linux-glibc2.12-x86_64 mysql
3、创建数据库安装目录、授权
#mkdir /data/mysql/data /data/mysql/log #chown -R mysql:mysql /data/mysql
4、验证权限
# ls -l mysql
total 52drwxr-xr-x 2 mysql mysql 4096 Aug 8 04:06 bin-rw-r--r-- 1 mysql mysql 17987 Jun 22 22:13 COPYINGdrwxr-xr-x 2 mysql mysql 4096 Aug 8 04:06 docsdrwxr-xr-x 3 mysql mysql 4096 Aug 8 04:06 includedrwxr-xr-x 5 mysql mysql 4096 Aug 8 04:06 libdrwxr-xr-x 4 mysql mysql 4096 Aug 8 04:06 man-rw-r--r-- 1 mysql mysql 2478 Jun 22 22:13 READMEdrwxr-xr-x 28 mysql mysql 4096 Aug 8 04:06 sharedrwxr-xr-x 2 mysql mysql 4096 Aug 8 04:06 support-files
5、编辑参数文件
vim /etc/my.cnf[client]port = 3306socket = /data/mysql/data/mysql.sock[mysqld]server_id=10port = 3306user = mysqlcharacter-set-server = utf8mb4default_storage_engine = innodblog_timestamps = SYSTEMsocket = /data/mysql/data/mysql.sockbasedir = /data/mysqldatadir = /data/mysql/datapid-file = /data/mysql/data/mysql.pidmax_connections = 1000max_connect_errors = 1000table_open_cache = 1024max_allowed_packet = 128Mopen_files_limit = 65535#####====================================[innodb]==============================innodb_buffer_pool_size = 1024Minnodb_file_per_table = 1innodb_write_io_threads = 4innodb_read_io_threads = 4innodb_purge_threads = 2innodb_flush_log_at_trx_commit = 1innodb_log_file_size = 512Minnodb_log_files_in_group = 2innodb_log_buffer_size = 16Minnodb_max_dirty_pages_pct = 80innodb_lock_wait_timeout = 30innodb_data_file_path=ibdata1:1024M:autoextendinnodb_undo_tablespaces=3#####====================================[log]==============================log_error = /data/mysql/log/mysql-error.log slow_query_log = 1long_query_time = 1 slow_query_log_file = /data/mysql/log/mysql-slow.logsql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
6、安装数据库
# yum -y install libaio# ./bin/mysqld --initialize --user=mysql --basedir=/data/mysql --datadir=/data/mysql/data --innodb_undo_tablespaces=3 --explicit_defaults_for_timestamp
7、配置启动文件
cp support-files/mysql.server /etc/init.d/mysqldchkconfig --add mysqldchkconfig mysqld onservice mysqld start
8、配置环境变量
vi /etc/profile#for mysql mysql_home=/data/mysqlPATH=$PATH:$mysql_home/binsource /etc/profile
9、查看默认密码
grep -i password /mysql/log/mysql-error.log
10、初始化密码
mysql -uroot -p'xxxxx'SET PASSWORD=PASSWORD('root');flush privileges;
11、数据库常规启停
#mysqladmin -uroot -proot shutdown#mysqld_safe --defaults-file=/etc/my.cnf ps -ef|grep mysql
12、安全配置
# mysql_secure_installation Securing the MySQL server deployment.Enter password for user root: VALIDATE PASSWORD PLUGIN can be used to test passwordsand improve security. It checks the strength of passwordand allows the users to set only those passwords which aresecure enough. Would you like to setup VALIDATE PASSWORD plugin?Press y|Y for Yes, any other key for No: yThere are three levels of password validation policy:LOW Length >= 8MEDIUM Length >= 8, numeric, mixed case, and special charactersSTRONG Length >= 8, numeric, mixed case, special characters and dictionary filePlease enter 0 = LOW, 1 = MEDIUM and 2 = STRONG: 2Using existing password for root.Estimated strength of the password: 25 Change the password for root ? ((Press y|Y for Yes, any other key for No) : yNew password: Re-enter new password: Sorry, passwords do not match.New password: Re-enter new password: Sorry, passwords do not match.New password: Re-enter new password: Estimated strength of the password: 50 Do you wish to continue with the password provided?(Press y|Y for Yes, any other key for No) : y ... Failed! Error: Your password does not satisfy the current policy requirementsNew password: Re-enter new password: Estimated strength of the password: 100 Do you wish to continue with the password provided?(Press y|Y for Yes, any other key for No) : yBy default, a MySQL installation has an anonymous user,allowing anyone to log into MySQL without having to havea user account created for them. This is intended only fortesting, and to make the installation go a bit smoother.You should remove them before moving into a productionenvironment.Remove anonymous users? (Press y|Y for Yes, any other key for No) : ySuccess.Normally, root should only be allowed to connect from'localhost'. This ensures that someone cannot guess atthe root password from the network.Disallow root login remotely? (Press y|Y for Yes, any other key for No) : ySuccess.By default, MySQL comes with a database named 'test' thatanyone can access. This is also intended only for testing,and should be removed before moving into a productionenvironment.Remove test database and access to it? (Press y|Y for Yes, any other key for No) : y - Dropping test database...Success. - Removing privileges on test database...Success.Reloading the privilege tables will ensure that all changesmade so far will take effect immediately.Reload privilege tables now? (Press y|Y for Yes, any other key for No) : ySuccess.All done!
相关阅读:
Mysql在各个系统的安装教程
Mysql 5.7.19 免安装版配置方法教程详解(64位)
Mysql 5.7.19 免安装版遇到的坑(收藏)
MySQL 5.7.19安装目录下创建my.ini文件的方法
数据
数据库
文件
配置
参数
目录
密码
教程
方法
系统
部分
安全
操作系统
变量
常规
权限
环境
用户
防火墙
防火
数据库的安全要保护哪些东西
数据库安全各自的含义是什么
生产安全数据库录入
数据库的安全性及管理
数据库安全策略包含哪些
海淀数据库安全审计系统
建立农村房屋安全信息数据库
易用的数据库客户端支持安全管理
连接数据库失败ssl安全错误
数据库的锁怎样保障安全
营业执照其他软件开发
上海野燕网络技术有限公司
快快云服务器
网络文明网络安全课件
广州辉冠互联网科技有限
sid服务器
互联网科技公司经营类目选择
内蒙远程服务器租赁价格表
河南专升本计算机网络技术
联想笔记本服务器端口
计算机软件开发合同欺诈案例
连接数据库失败什么原因
数据库加密技术结果分析
涉密广域网网络安全等级
从事软件开发的印度人是什么种姓
网络技术服务咨询什么价格
南信大考研网络安全
ug服务器无效的许可证
陶瓷大数据库
网络技术专升本真题
p2p网络技术具有什么特点
vs2015打开数据库连接
漳州市富强网络技术有限公司
小迪网络安全渗透培训
sql数据库如何引用外部关键字
数字资产交易软件开发商
网络技术发展与著作权保护
mes系统软件开发合同
c c 做软件开发
美团外卖数据库设计表