##查询已安装的 mariadb
rpm -qa | grep mariadb
###删除查询的结果
rpm -e xxxx
##安装mysql8(xxxx 用tab自动补全)
rpm -ivh mysql-community-common-8 -xxxx --nodeps --force
rpm -ivh mysql-community-libs-8-xxxx --nodeps --force
rpm -ivh mysql-community-client-8 -xxx–nodeps --force
rpm -ivh mysql-community-server-8.xxxx --nodeps --force
##初始化数据库并启动
mysqld --initialize;
chown mysql:mysql /var/lib/mysql -R;
systemctl start mysqld.service;
systemctl enable mysqld;
##查看初始密码
cat /var/log/mysqld.log | grep password
##登入
mysql -u -p
#输入查询的密码
##修改新的密码
ALTER USER ‘root’@‘localhost’ IDENTIFIED WITH mysql_native_password BY ‘密码’;
##远程登入
create user ‘root’@‘%’ identified with mysql_native_password by ‘root’;
grant all privileges on . to ‘root’@‘%’ with grant option;
flush privileges;
linux安装mysql8
最新推荐文章于 2024-11-08 14:34:47 发布