赞
踩
1.MySQL8.0安装
1.1配置yum仓库
rpm --import https://repo.mysql.com/RPM-GPG-KEY-mysql-2022
安装mysql8.0
rpm -Uvh https://dev.mysql.com/get/mysql80-community-release-el7-2.noarch.rpm
1.2使用yum安装MySQL
yum -y install mysql-community-server
运行 yum install mysql-community-server 安装mysql数据库。
Q:
Downloading packages: 警告:/var/cache/yum/x86_64/7/mysql80-community/packages/mysql-community-client-8.0.36-1.el7.x86_64.rpm: 头V4 RSA/SHA256 Signature, 密钥 ID a8d3785c: NOKEY 从 file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql 检索密钥 导入 GPG key 0x5072E1F5: 用户ID : "MySQL Release Engineering mysql-build@oss.oracle.com" 指纹 : a4a9 4068 76fc bd3c 4567 70c8 8c71 8d3b 5072 e1f5 软件包 : mysql80-community-release-el7-2.noarch (installed) 来自 : /etc/pki/rpm-gpg/RPM-GPG-KEY-mysql mysql-community-client-8.0.36-1.el7.x86_64.rpm 的公钥尚未安装 失败的软件包是:mysql-community-client-8.0.36-1.el7.x86_64 GPG 密钥配置为:file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
!改用命令: yum install mysql-community-server --nogpgcheck
1.3启动MySQL并配置开机自启动
systemctl start mysqld
systemctl enable mysqld
1.4检查MySQL运行状态
systemctl status mysqld
2.配置
2.1获取MySQL初始密码
grep 'temporary password' /var/log/mysqld.log
2.2登录MySQL
mysql -uroot -p
2.3修改root密码
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '密码'
我的密码: Hjy123456^
2.4开启远程登陆,并设置密码
create user 'root'@'%' IDENTIFIED WITH mysql_native_password BY '密码'
3.1.MySQL8.0安装(Ubuntu)
apt install -y mysql-server
启动:
/etc/init.d/mysql start
/etc/init.d/mysql stop
/etc/init.d/mysql status
登录mysql设置密码
进入mysql:mysql
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '123456'
初始化mysql_secure_installation(配置程序)
登录:mysql -uroot -p
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。