MySQL安装
MySQL安装
卸载mariadb
rpm -qa|grep -i mariadb
sudo rpm -e --nodeps mariadb-libs-5.5.60-1.el7_5.x86_64
安装必备软件
sudo yum install libaio* -y
sudo yum -y install numactl.x86_64
下载软件
sudo wget https://cdn.mysql.com//Downloads/MySQL-5.7/mysql-5.7.26-linux-glibc2.12-x86_64.tar.gz
sudo tar -zxvf mysql-5.7.26-linux-glibc2.12-x86_64.tar.gz -C /usr/local/
mv /usr/local/mysql-5.7.26-linux-glibc2.12-x86_64 mysql
cd /usr/local/mysql
sudo mkdir data tmp
sudo chmod -R 777 tmp/
启动MySQL
sudo bin/mysqld --initialize --user=bigdata --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data
# 会生成data和temp还有登录密码
sudo cp support-files/mysql.server /etc/init.d/mysqld
sudo chmod u+x /etc/init.d/mysqld
sudo ln -s /usr/local/mysql/bin/mysql /usr/local/bin
sudo ln -s /usr/local/mysql/bin/mysqladmin /usr/local/bin
sudo ln -s /usr/local/mysql/bin/mysqld_safe /usr/local/bin
sudo ln -s /usr/local/mysql/tmp/mysql.sock /tmp/mysql.sock
修改密码
/etc/init.d/mysqld start
mysql -u root -p
set password=password('root');
SHOW VARIABLES LIKE 'char%';
配置文件
sudo vim /etc/my.cnf
# 写入内容
[mysql]
default-character-set=utf8mb4
[mysqld]
basedir=/usr/local/mysql
datadir=/usr/local/mysql/data
socket=/usr/local/mysql/tmp/mysql.sock
# 是否支持符号链接
symbolic-links=0
# 对大小写敏感
lower_case_table_names=1
# 默认字符集
collation-server=utf8mb4_bin
character-set-server=utf8mb4
# 端口
port=16033
# 最大连接数
max_connections=2000
# 慢查询
slow_query_log=ON
slow_query_log_file=/usr/local/mysql/log/slow.log
# 超过3秒的查询
long_query_time=3
# binlog日志
log-bin=/usr/local/mysql/log/mysql-binlog
server-id=1
# 以xx用户启动
user=xx
log-error=/usr/local/mysql/log/error.log
来源:CSDN
作者:Explorren
链接:https://blog.csdn.net/Explorren/article/details/103636393