mysql5.7.17安装配置
发表于:2025-02-08 作者:千家信息网编辑
千家信息网最后更新 2025年02月08日,一、创建msql用户#添加运行mysql的用户,禁止该用户登录系统[root@openstack-01 ~]# useradd mysql -s /sbin/nologin二、创建相关目录#创建目录
千家信息网最后更新 2025年02月08日mysql5.7.17安装配置
一、创建msql用户
#添加运行mysql的用户,禁止该用户登录系统[root@openstack-01 ~]# useradd mysql -s /sbin/nologin
二、创建相关目录
#创建目录[root@openstack-01 ~]# mkdir /data/mysql/mysql3306/{conf,data,logs,tmp} -p#修改目录权限[root@openstack-01 ~]# chown -R mysql.mysql /data/mysql
三、创建配置文件
[root@openstack-01 ~]# cat /data/mysql/mysql3306/conf/mysql_3306.cnf #my.cnf[client]port = 3306socket = /tmp/mysql3306.sock[mysql]prompt="\\u@\\h [\\d]>" #pager="less -i -n -S"#tee=/opt/mysql/query.logno-auto-rehash[mysqld]#miscuser = mysqlbasedir = /usr/local/mysqldatadir = /data/mysql/mysql3306/dataport = 3306socket = /tmp/mysql3306.sockevent_scheduler = 0tmpdir = /data/mysql/mysql3306/tmp#timeoutinteractive_timeout = 300wait_timeout = 300#character setcharacter-set-server = utf8open_files_limit = 65535max_connections = 100max_connect_errors = 100000lower_case_table_names =1#symi replication#rpl_semi_sync_master_enabled=1#rpl_semi_sync_master_timeout=1000 # 1 second#rpl_semi_sync_slave_enabled=1#logslog-output=fileslow_query_log = 1slow_query_log_file = slow.loglog-error = error.loglog_warnings = 2pid-file = mysql.pidlong_query_time = 1#log-slow-admin-statements = 1#log-queries-not-using-indexes = 1log-slow-slave-statements = 1#binlog#binlog_format = STATEMENTbinlog_format = rowserver-id = 1003306log-bin = /data/mysql/mysql3306/logs/mysql-binmax_binlog_size = 256Msync_binlog = 0expire_logs_days = 10#procedure log_bin_trust_function_creators=1#gtid-mode = onenforce-gtid-consistency=1#relay logskip_slave_start = 1max_relay_log_size = 128Mrelay_log_purge = 1relay_log_recovery = 1relay-log=relay-binrelay-log-index=relay-bin.indexlog_slave_updates#slave-skip-errors=1032,1053,1062#skip-grant-tables#buffers & cachetable_open_cache = 2048table_definition_cache = 2048table_open_cache = 2048max_heap_table_size = 96Msort_buffer_size = 128Kjoin_buffer_size = 128Kthread_cache_size = 200query_cache_size = 0query_cache_type = 0query_cache_limit = 256Kquery_cache_min_res_unit = 512thread_stack = 192Ktmp_table_size = 96Mkey_buffer_size = 8Mread_buffer_size = 2Mread_rnd_buffer_size = 16Mbulk_insert_buffer_size = 32M#myisammyisam_sort_buffer_size = 128Mmyisam_max_sort_file_size = 10Gmyisam_repair_threads = 1#innodbinnodb_buffer_pool_size = 100Minnodb_buffer_pool_instances = 1innodb_data_file_path = ibdata1:100M:autoextendinnodb_flush_log_at_trx_commit = 2innodb_log_buffer_size = 8Minnodb_log_file_size = 100Minnodb_log_files_in_group = 3innodb_max_dirty_pages_pct = 50innodb_file_per_table = 1innodb_rollback_on_timeoutinnodb_io_capacity = 2000transaction_isolation = READ-COMMITTEDinnodb_flush_method = O_DIRECT
四、初始化mysql
#开始初始化[root@openstack-01 ~]# /usr/local/mysql-5.7.17-linux-glibc2.5-x86_64/bin/mysqld --defaults-file=/data/mysql/mysql3306/conf/mysql_3306.cnf --basedir=/usr/local/mysql-5.7.17-linux-glibc2.5-x86_64/ --initialize#查看初始化后的结果[root@openstack-01 ~]# ll /data/mysql/mysql3306/data/total 409648-rw-r----- 1 mysql mysql 56 Jun 10 17:27 auto.cnf-rw-r----- 1 mysql mysql 6236 Jun 10 17:27 error.log-rw-r----- 1 mysql mysql 413 Jun 10 17:27 ib_buffer_pool-rw-r----- 1 mysql mysql 104857600 Jun 10 17:27 ibdata1-rw-r----- 1 mysql mysql 104857600 Jun 10 17:27 ib_logfile0-rw-r----- 1 mysql mysql 104857600 Jun 10 17:27 ib_logfile1-rw-r----- 1 mysql mysql 104857600 Jun 10 17:27 ib_logfile2drwxr-x--- 2 mysql mysql 4096 Jun 10 17:27 mysqldrwxr-x--- 2 mysql mysql 8192 Jun 10 17:27 performance_schema-rw-r----- 1 mysql mysql 217 Jun 10 17:27 slow.logdrwxr-x--- 2 mysql mysql 8192 Jun 10 17:27 sys#获取root用户密码[root@openstack-01 ~]# grep password /data/mysql/mysql3306/data/error.log |awk '{print $11}'_:;II,r0I;oo
五、启动mysql
[root@openstack-01 ~]# /usr/local/mysql-5.7.17-linux-glibc2.5-x86_64/bin/mysqld --defaults-file=/data/mysql/mysql3306/conf/mysql_3306.cnf &[1] 14632[root@openstack-01 ~]# ps aux |grep mysql |grep -v grepmysql 14632 2.7 9.8 1067652 184596 pts/0 Sl 17:30 0:00 /usr/local/mysql-5.7.17-linux-glibc2.5-x86_64/bin/mysqld --defaults-file=/data/mysql/mysql3306/conf/mysql_3306.cnf[root@openstack-01 ~]# ss -tnl |grep 3306LISTEN 0 70 :::3306 :::* #登录mysql[root@openstack-01 ~]# /usr/local/mysql-5.7.17-linux-glibc2.5-x86_64/bin/mysql -u root -p -S /tmp/mysql3306.sockEnter password: #输入上文中获取到的密码Welcome to the MySQL monitor. Commands end with ; or \g.Your MySQL connection id is 3Server version: 5.7.17-logCopyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.Oracle is a registered trademark of Oracle Corporation and/or itsaffiliates. Other names may be trademarks of their respectiveowners.Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.mysql> #修改root密码mysql> alter user 'root'@'localhost' identified by '123456';Query OK, 0 rows affected (0.00 sec)mysql> flush privileges;Query OK, 0 rows affected (0.00 sec)#用新密码重新登录[root@openstack-01 ~]# /usr/local/mysql-5.7.17-linux-glibc2.5-x86_64/bin/mysql -u root -p -S /tmp/mysql3306.sockEnter password: #输入新设置的密码,测试正常Welcome to the MySQL monitor. Commands end with ; or \g.Your MySQL connection id is 4Server version: 5.7.17-log MySQL Community Server (GPL)Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.Oracle is a registered trademark of Oracle Corporation and/or itsaffiliates. Other names may be trademarks of their respectiveowners.Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.mysql>
密码
用户
目录
登录
输入
配置
上文
文件
权限
系统
结果
新密
新设
测试
运行
数据库的安全要保护哪些东西
数据库安全各自的含义是什么
生产安全数据库录入
数据库的安全性及管理
数据库安全策略包含哪些
海淀数据库安全审计系统
建立农村房屋安全信息数据库
易用的数据库客户端支持安全管理
连接数据库失败ssl安全错误
数据库的锁怎样保障安全
数据库readpe
网络安全公司管理员
网络安全知识竞赛营口
温州威密软件开发有限公司
数据库中表示换行
教育软件开发流程
内蒙古大数据网络技术开发计划表
申皓多媒体网络技术
传奇数据库排序算法
软件开发类项目管理流程
数据库连接 asp
字节互联网科技有限公司
特瑞格网络技术靠谱吗
广东合道互联网科技
新手学软件开发配电脑
净网2018网络安全教育活动
malody 谱面服务器主机
武汉市手游软件开发
网络安全信息的篡改事件
服务器上的硬盘怎么拷贝到电脑上
网络安全知识竞赛营口
网络安全保障工作的基本原则
埃安车联服务器维护中
sql19版的数据库怎么使用
lol游戏连接服务器异常
如何让软件开发者知道我们想要的
服务器电源关机后很响
河北商城软件开发定制
个人网络安全防范工作总结
大专里的计算机网络技术学什么