mysql8.0虚拟机安装
时间: 2023-10-28 16:07:14 浏览: 198
mysql-8.0安装包
在已经安装好linux虚拟机的前提下,可以按照以下步骤安装mysql8.0:
1. 下载mysql8.0的yum源:wget https://dev.mysql.com/get/mysql80-community-release-el7-5.noarch.rpm
2. 执行安装:rpm -ivh mysql80-community-release-el7-5.noarch.rpm
3. 安装mysql8.0:yum install mysql-community-server
4. 启动mysql服务:systemctl start mysqld
5. 查看mysql服务状态:systemctl status mysqld
6. 登录mysql:mysql -u root -p
7. 修改mysql密码:ALTER USER 'root'@'localhost' IDENTIFIED BY 'newpassword';
8. 退出mysql:exit
另外,如果想要使用mysql8.0的压缩包安装,可以按照以下步骤:
1. 下载mysql8.0的压缩包:wget https://cdn.mysql.com//Downloads/MySQL-8.0/mysql-8.0.19-linux-glibc2.12-x86_64.tar.xz
2. 解压缩包:tar -xvf mysql-8.0.19-linux-glibc2.12-x86_64.tar.xz
3. 将解压后的文件夹移动到指定目录:mv mysql-8.0.19-linux-glibc2.12-x86_64 /usr/local/mysql
4. 创建mysql用户组和用户:groupadd mysql && useradd -r -g mysql -s /bin/false mysql
5. 修改mysql文件夹的权限:chown -R mysql:mysql /usr/local/mysql
6. 初始化mysql:/usr/local/mysql/bin/mysqld --initialize --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data
7. 启动mysql服务:/usr/local/mysql/bin/mysqld_safe --user=mysql &
8. 登录mysql:/usr/local/mysql/bin/mysql -u root -p
9. 修改mysql密码:ALTER USER 'root'@'localhost' IDENTIFIED BY 'newpassword';
10. 退出mysql:exit
阅读全文