Linux 安装和初步配置 mysql

2022/2/3 2:14:10

本文主要是介绍Linux 安装和初步配置 mysql,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!

  • 安装
  • centos 8
sudo dnf install mysql-server
sudo systemctl start mysqld.service
sudo systemctl enable mysqld.service
sudo systemctl status mysqld.service
mysqladmin -u root -p version
  • opensuse
wget  -c https://repo.mysql.com//mysql80-community-release-sl15-5.noarch.rpm
rpm -ivh mysql80-community-release-sl15-5.noarch.rpm
sudo rpm --import /etc/RPM-GPG-KEY-mysql
sudo zypper ref mysql80-community
sudo zypper install -y mysql-community-server
# root 默认密码 在 /var/log/mysql/mysqld.log
sudo systemctl enable mysql;
sudo systemctl start mysql;
sudo systemctl status mysql;

修改root密码,创建admin用户并允许远程登录,记得服务器防火墙的3306端口要打开

sudo mysql_secure_installation 根据提示修改root密码

mysql -u root -p #输入密码然后登录mysql
mysql> CREATE USER `admin`@`%` IDENTIFIED BY 'password';
mysql> GRANT ALL ON *.* TO `admin`@`%` WITH GRANT OPTION;


这篇关于Linux 安装和初步配置 mysql的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!


扫一扫关注最新编程教程