wget https://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.25-linux-glibc2.12-x86_64.tar.gz yum -y install libaio tar -zxf mysql-5.7.25-linux-glibc2.12-x86_64.tar.gz mkdir /usr/local/data/db/ mv mysql-5.7.25-linux-glibc2.12-x86_64 mysql cd mysql bin/mysqld --initialize --user=mysql --basedir=/usr/local/data/mysql/ --datadir=/usr/local/data/db/ cp support-files/mysql.server /etc/init.d/mysqld #修改mysqld basedir,datadir vim /etc/my.cnf [mysql] # 设置mysql客户端默认字符集 default-character-set=utf8 socket=/var/lib/mysql/mysql.sock [mysqld] #skip-name-resolve #设置3306端口 bind-address = 10.10.10.10 port = 3306 socket=/var/lib/mysql/mysql.sock # 设置mysql的安装目录 basedir=/usr/local/data/mysql # 设置mysql数据库的数据的存放目录 datadir=/usr/local/data/db # 允许最大连接数 max_connections=2000 # 服务端使用的字符集默认为8比特编码的latin1字符集 character-set-server=utf8 # 创建新表时将使用的默认存储引擎 default-storage-engine=INNODB #lower_case_table_name=1 max_allowed_packet=16M