openeuler24安装mysql8.4.tar操作步骤
时间: 2024-09-27 20:05:43 浏览: 63
安装MySQL 8.4 on OpenEuler 24操作系统通常包括以下几个步骤:
1. **更新系统**:
```
sudo apt-get update && sudo apt-get upgrade -y
```
2. **下载MySQL源码** (假设您已经从MySQL官方网站下载了tar文件) :
```
wget https://dev.mysql.com/get/mysql84-community-release-eol-ubuntu20_24-0.asc
gpg --dearmor mysql84-community-release-eol-ubuntu20_24-0.asc | sudo tee /etc/apt/sources.list.d/mysql.list
```
3. **添加GPG密钥**:
```
sudo apt-key adv --recv-keys E5F7DB59
```
4. **启用新的软件包源**:
```
sudo apt-get update
```
5. **安装构建工具** (如果尚未安装):
```
sudo apt-get install build-essential libaio1-dev libncurses5-dev libssl-dev libmariadbclient-dev -y
```
6. **解压并进入目录**:
```
tar -zxvf mysql8.4.tar.gz
cd mysql-8.4.42
```
7. **配置安装** (编辑my.cnf文件以适应您的需求,然后运行配置脚本):
```
cp support-files/my-medium.cnf my.cnf
sudo ./configure --prefix=/usr/local/mysql --datadir=/var/lib/mysql --sysconfdir=/etc/mysql
```
8. **编译安装**:
```
make && sudo make install
```
9. **初始化数据库**:
```
sudo /usr/local/mysql/scripts/mysql_install_db --user=mysql --basedir=$(readlink -f $(dirname $0))/.. --ldata=/var/lib/mysql
```
10. **设置开机启动服务**:
```
sudo systemctl enable mysql.service
```
11. **启动服务**:
```
sudo systemctl start mysql.service
```
12. **验证安装**:
```
mysql -u root -p
```
阅读全文