帮我写一个mysql5.7版本的centos7上的安装sehll脚本,要求大小写不敏感,sehll的开头可以自己指定安装的目录和具体版本
时间: 2024-06-10 17:04:01 浏览: 11
好的,我可以为您编写安装mysql5.7版本的centos7的sehll脚本。以下是我为您准备的脚本:
```#!/bin/sh
# MySQL installation script for CentOS 7
# Set the installation directory and version number
INSTALL_DIR=/usr/local/mysql
VERSION=5.7.31
# Download the MySQL repository configuration package
yum -y install wget
wget https://dev.mysql.com/get/mysql57-community-release-el7-11.noarch.rpm
# Install the MySQL repository configuration package
yum -y localinstall mysql57-community-release-el7-11.noarch.rpm
# Install the MySQL server and client packages
yum -y install mysql-community-server
yum -y install mysql-community-client
# Start the MySQL server and enable it to start automatically on boot
systemctl start mysqld
systemctl enable mysqld
# Set the MySQL root user password
temp_password=$(grep 'temporary password' /var/log/mysqld.log | awk '{print $NF}')
mysql --connect-expired-password -uroot -p"$temp_password" -e "ALTER USER 'root'@'localhost' IDENTIFIED BY 'YourNewPasswordHere';FLUSH PRIVILEGES;"
# Set the MySQL configuration file to be case insensitive
echo "lower_case_table_names = 1" >> /etc/my.cnf
# Restart the MySQL server to apply the configuration changes
systemctl restart mysqld
```
请注意,这个脚本将下载并安装mysql5.7版本,然后启动mysql服务并且设置mysql root用户的密码。此外,该脚本将配置mysql以使其大小写不敏感。请提前设置好您的新密码并将“YourNewPasswordHere”替换成您的新密码。如有需要,您可以根据实际情况更改安装目录和版本号。
相关推荐
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![sh](https://img-home.csdnimg.cn/images/20210720083646.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)