centos7服务器安装 mysql
一、下载
官网:https://dev.mysql.com/downloads/mysql/
二、安装
1.查看有没有需要卸载的SQL包,一般系统的mariadb是自带的,需要卸载
rpm -qa | grep mysql
rpm -qa | grep mariadb
例如:安装过MySQL
使用如下命令卸载
rpm -e mysql-community-libs-8.1.0-1.el8.x86_64 --nodeps
2.解压与rpm安装
解压
tar xvf mysql-8.1.0-1.el7.x86_64.rpm-bundle.tar
安装
rpm -ivh mysql-community-common-8.1.0-1.el7.x86_64.rpm
rpm -ivh mysql-community-client-plugins-8.1.0-1.el7.x86_64.rpm
rpm -ivh mysql-community-libs-8.1.0-1.el7.x86_64.rpm
rpm -ivh mysql-community-client-8.1.0-1.el7.x86_64.rpm
rpm -ivh mysql-community-icu-data-files-8.1.0-1.el7.x86_64.rpm
rpm -ivh mysql-community-server-8.1.0-1.el7.x86_64.rpm --nodeps
显示需要依赖的,直接用–nodeps参数
3、登录配置
启动
systemctl start mysqld
systemctl enable mysqld
获取密码
cat /var/log/mysqld.log | grep password
登录
mysql -u root -p
修改密码
alter user 'root'@'localhost' identified with mysql_native_password by 'Ljh@new2024';
刷新权限
flush privileges;
配置远程登录
use mysql;
select host, user from user;
update user set host = '%' where user = 'root';
select host, user from user;
flush privileges;
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。
文章由极客之音整理,本文链接:https://www.bmabk.com/index.php/post/196215.html