cd /usr/local/
wget https://cdn.mysql.com/archives/mysql-5.6/mysql-5.6.45-linux-glibc2.12-x86_64.tar.gz
tar -zxvf mysql-5.6.45-linux-glibc2.12-x86_64.tar.gz
rm -rf mysql-5.6.45-linux-glibc2.12-x86_64.tar.gz
mv mysql-5.6.45-linux-glibc2.12-x86_64/ mysql
groupadd mysql
useradd -r -g mysql mysql
groups mysql
mkdir -p /data/mysql
chown mysql:mysql -R /data/mysql
vim /etc/my.cnf
内容如下:
[mysqld] bind-address=0.0.0.0 port=3306 user=mysql basedir=/usr/local/mysql datadir=/data/mysql socket=/tmp/mysql.sock log-error=/data/mysql/mysql.err pid-file=/data/mysql/mysql.pid #character config character_set_server=utf8mb4 symbolic-links=0 explicit_defaults_for_timestamp=true
cd /usr/local/mysql/bin/
执行初始化命令
./mysqld --defaults-file=/etc/my.cnf --basedir=/usr/local/mysql/ --datadir=/data/mysql/ --user=mysql --initialize
cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysql
service mysql start ps -ef|grep mysql
./bin/mysqladmin -u root password '123456'
./bin/mysql -h127.0.0.1 -uroot -p000000
Linux在登录之后 开启远程登录,刷新权限
grant all privileges on *.* to root@'%' identified by '123456';
flush privileges;
cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysqld
chmod +x /etc/init.d/mysqld
chkconfig --add mysqld
./mysqld: error while loading shared libraries: libnuma.so.1: cannot open shared object file: No such file or directory
解决办法:
切换到local目录,然后执行
yum install -y libaio
yum -y install numactl
Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
解决办法:
切换到 mysql目录下,执行
./scripts/mysql_install_db --user=mysql
应该是被防火墙给拦截了,可以先在腾讯云控制台 防火墙 修改安全规则 ,开放3306端口
如果还是不行就
先查看防火墙状态
firewall-cmd --state
查看开放的端口
firewall-cmd --list-all
开放3306端口
firewall-cmd --zone=public --add-port=3306/tcp --permanent
最后重启防火墙
firewall-cmd --reload