mysql-5.7.31快速安装记录(Centos 7)

复制代码
yum -y install gcc gcc-c++ gcc-g77 autoconf automake zlib* fiex* libxml* ncurses-devel libmcrypt* libtool-ltdl-devel* make cmake curl curl-devel libaio

tar -xf mysql-5.7.31-linux-glibc2.12-x86_64.tar.gz

mv mysql-5.7.31-linux-glibc2.12-x86_64/* /opt/mysql


groupadd mysql
useradd -r -g mysql -s /bin/false mysql

chown -R mysql.mysql /opt/mysql

sed -i 's/^SELINUX=.*/SELINUX=disabled/' /etc/selinux/config


/opt/mysql/bin/mysql_install_db --defaults-file=/etc/my.cnf --basedir=/opt/mysql/ --datadir=/opt/mysql/data --user=mysql
#可能会报初始化命令已弃用,按提示执行新命令即可


#---------------------------------------------

vim /etc/my.cnf
[mysqld]
skip-host-cache
skip-name-resolve

#skip-grant-tables
port = 3306


innodb_flush_log_at_trx_commit=0

lower_case_table_names=1
character-set-server=utf8mb4
max_connections=1000
innodb_flush_log_at_trx_commit=0

max_allowed_packet = 20M

slow_query_log = ON
slow_query_log_file = /opt/mysql/data/slow-query.log
long_query_time = 2
log-queries-not-using-indexes
log-slow-admin-statements
log-slow-slave-statements
log_queries_not_using_indexes = OFF
# Disabling symbolic-links is recommended to prevent assorted security risks
# symbolic-links=0

# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0

[mysqld_safe]
general_log=1
general_log_file=/var/log/mysqld.log

log-error=/var/log/mysqld.error.log

slow_query_log=1
slow_query_log_file=/var/log/mysqld.slow.log

long_query_time=2
log_output='FILE'


pid-file=/var/run/mysqld/mysqld.pid


#---------------------------------------------


vim /etc/profile

export PATH=$PATH:/opt/mysql/bin


source /etc/profile


cp -rp support-files/mysql.server /etc/init.d/mysqld


vim /etc/init.d/mysqld

basedir=/opt/mysql
datadir=/opt/mysql/data



#初始化密码
vim /etc/my.cnf
skip grant tables

/etc/init.d/mysqld restart

update mysql.user set authentication_string=password('VDanny@123') where user="root" and host="localhost"
flush privileges;



vim /etc/my.cnf
#skip grant tables

/etc/init.d/mysqld restart

ALTER USER 'root'@'localhost' IDENTIFIED BY 'VDanny@123';
grant all on *.* to 'root'@'%' identified by 'VDanny@123';


#验证
mysql -uroot -p -h 192.168.1.1
复制代码

 

posted @   叮伱格斐呃  阅读(114)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 全程不用写代码,我用AI程序员写了一个飞机大战
· DeepSeek 开源周回顾「GitHub 热点速览」
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 记一次.NET内存居高不下排查解决与启示
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了
Live2D
欢迎阅读『mysql-5.7.31快速安装记录(Centos 7)』
点击右上角即可分享
微信分享提示