欧美一区二区三区,国内熟女精品熟女A片视频小说,日本av网,小鲜肉男男GAY做受XXX网站

centos 怎么重新安裝mysql

謝彥文2年前13瀏覽0評論

如果你需要重新安裝MySQL,遵循以下步驟:

1. 首先,卸載現有的MySQL:
sudo yum remove mysql-server mysql mysql-libs
2. 然后,刪除MySQL數據目錄:
sudo rm -rf /var/lib/mysql
3. 更新CentOS軟件包:
sudo yum update
4. 安裝MySQL依賴:
sudo yum install wget
sudo yum groupinstall 'Development Tools'
sudo yum install libaio libaio-devel
5. 下載MySQL二進制文件并解壓縮:
wget https://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.34-linux-glibc2.12-x86_64.tar.gz
sudo tar -xzvf mysql-5.7.34-linux-glibc2.12-x86_64.tar.gz -C /usr/local/
mv /usr/local/mysql-5.7.34-linux-glibc2.12-x86_64 /usr/local/mysql
6. 創建MySQL配置文件:
sudo touch /etc/my.cnf
sudo echo "[mysqld]" >>/etc/my.cnf
sudo echo "basedir=/usr/local/mysql" >>/etc/my.cnf
sudo echo "datadir=/var/lib/mysql" >>/etc/my.cnf
sudo echo "socket=/var/lib/mysql/mysql.sock" >>/etc/my.cnf
sudo echo "port=3306" >>/etc/my.cnf
7. 設置MySQL數據目錄權限:
sudo chown -R mysql:mysql /var/lib/mysql
8. 初始化MySQL:
sudo /usr/local/mysql/bin/mysqld --initialize --user=mysql
9. 開啟MySQL服務:
sudo systemctl start mysql
sudo systemctl status mysql
10. 配置MySQL root密碼:
sudo /usr/local/mysql/bin/mysql_secure_installation

完成以上步驟,您已成功重新安裝MySQL。