以下是在CentOS系统下编译安装MySQL以及设置相关yum源的教程:
安装编译MySQL所需的依赖包:
sudo yum install -y gcc-c++ cmake make
sudo yum install -y ncurses-devel
下载MySQL源码包:
wget https://dev.mysql.com/get/Downloads/MySQL-8.0/mysql-8.0.23.tar.gz
解压源码包:
tar -zxvf mysql-8.0.23.tar.gz
编译MySQL:
cd mysql-8.0.23
cmake .
make
sudo make install
创建MySQL配置文件:
sudo cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysql
sudo chmod +x /etc/init.d/mysql
sudo vi /etc/my.cnf
在my.cnf文件中添加以下内容:
[mysqld]
basedir=/usr/local/mysql
datadir=/usr/local/mysql/data
socket=/tmp/mysql.sock
初始化MySQL数据库:
sudo /usr/local/mysql/bin/mysqld --initialize --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data
启动MySQL服务:
sudo service mysql start
设置MySQL开机自启动:
sudo chkconfig --add mysql
sudo chkconfig mysql on
设置MySQL的root密码:
sudo /usr/local/mysql/bin/mysqladmin -u root password 'your_password'
将'your_password'替换为你自己的密码。
安装并配置MySQL的yum源:
sudo wget https://dev.mysql.com/get/mysql80-community-release-el7-3.noarch.rpm
sudo rpm -ivh mysql80-community-release-el7-3.noarch.rpm
sudo yum install -y mysql-community-server
启动MySQL服务:
sudo systemctl start mysqld
设置MySQL开机自启动:
sudo systemctl enable mysqld
至此,你已经成功在CentOS系统下编译安装了MySQL,并设置了相关的yum源。
Laravel PHP 深圳智简公司。版权所有©2023-2043 LaravelPHP 粤ICP备2021048745号-3
Laravel 中文站