rpm -qa | grep mysql
rm -rf mysql-8.0.26-1.module_el8.4.0+915+de215114.x86_64
rm -rf mysql-server-8.0.26-1.module_el8.4.0+915+de215114.x86_64
rm -rf mysql-errmsg-8.0.26-1.module_el8.4.0+915+de215114.x86_64
rm -rf mysql80-community-release-el8-5.noarch
rm -rf mysql-common-8.0.26-1.module_el8.4.0+915+de215114.x86_64
whereis mysql
rm -rf /usr/bin/mysql
rm -rf /usr/lib64/mysql
rm -rf /usr/share/mysql
rm -rf /usr/share/man/man1/mysql.1.gz
find / -name mysql
rm -rf /var/lib/selinux/targeted/active/modules/100/mysql
rm -rf /var/lib/selinux/targeted/tmp/modules/100/mysql
rm -rf /var/lib/mysql
rm -rf /var/lib/mysql/mysql
rm -rf var/log/mysql
rm -rf /var/log/mysql
rm -rf /usr/share/bash-completion/completions/mysql
rm -rf /usr/share/selinux/packages/mysql
rm -rf /usr/share/selinux/targeted/default/active/modules/100/mysql
MySQL官网tar包下载链接:https://dev.mysql.com/downloads/mysql/
wget https://dev.mysql.com/get/mysql-8.0.33-linux-glibc2.28-x86_64.tar.gz
tar -zvxf mysql-8.0.33-linux-glibc2.28-x86_64.tar.gz
mv mysql-8.0.33-linux-glibc2.28-x86_64 /usr/local/mysql
mkdir /usr/local/mysql/data
groupadd mysql;
useradd -g mysql mysql;
chown -R mysql.mysql /usr/local/mysql/
touch /etc/my.cnf
[mysql]
default-character-set=utf8
[mysqld]
port=3306
default_authentication_plugin=mysql_native_password
socket = /usr/local/mysql/mysql.sock
basedir=/usr/local/mysql
datadir=/usr/local/mysql/data/
character-set-server=utf8
default-storage-engine=InnoDB
collation-server=utf8_unicode_ci
init_connect='SET NAMES utf8'
innodb_buffer_pool_size=512M
innodb_flush_log_at_trx_commit=0
innodb_lock_wait_timeout=31536000
innodb_log_buffer_size=8M
innodb_log_file_size=16M
join_buffer_size=200M
key_buffer_size=400M
log-error=/usr/local/mysql/mysql.log
pid-file=/usr/local/mysql/mysql.pid
log_error_verbosity=1
max_allowed_packet=2000M
max_connections=1000
max_heap_table_size=6400M
myisam_max_sort_file_size=64M
myisam_sort_buffer_size=32M
read_buffer_size=4M
read_rnd_buffer_size=4000M
server_id=1
skip-external-locking=on
sort_buffer_size=256kb
table_open_cache=256
thread_cache_size=16
tmp_table_size=64M
wait_timeout=31536000
interactive_timeout=31536000
sql_mode="STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION"
group_concat_max_len=10240
[client]
port=3306
default-character-set=utf8
socket = /usr/local/mysql/mysql.sock
chown -R mysql:mysql /usr/local/mysql
/usr/local/mysql/bin/mysqld --user=mysql --initialize --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data
如果报错 提示:
error while loading shared libraries: libaio.so.1: cannot open shared object file directory
可以执行以下命令
yum install libaio-devel.x86_64
/usr/local/mysql/bin/mysqld --user=mysql --initialize --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data
/usr/local/mysql/mysql.log
cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysqld
chmod +x /etc/init.d/mysqld
chmod +x /etc/rc.d/init.d/mysqld
chkconfig --add mysqld
chkconfig --list mysqld
/etc/profile
在底部添加如下命令export PATH=$PATH:/usr/local/mysql/bin:/usr/local/mysql/lib
export PATH
source /etc/profile
service mysql start
mysql -uroot -p;
/etc/my.cnf
里 在[mysqld]
下添加skip-grant-tables
ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.
flush privileges;
ALTER USER 'root'@'localhost' IDENTIFIED BY 'mysql';
exit
quit
vim /etc/my.cnf
,注释掉下面两行内容,重启mysql就可以#skip_networking
#skip-grant-tables
netstat -untlp
vim /etc/my.cnf
service mysqld restart
update user set host='%' where user='root'