美文网首页
Linux 系统怎么安装 MySQL

Linux 系统怎么安装 MySQL

作者: 孙庚辛 | 来源:发表于2021-12-17 20:12 被阅读0次

首先执行命令

sudo apt install mariadb-server

Install MariaDB in Debian 10

之后可以通过 systemctl 命令控制数据库的启动和停止

systemctl start mariadb
systemctl restart mariadb
systemctl stop mariadb
systemctl reload mariadb

Check MariaDB Status

Securing MariaDB Server in Debian 10

使用 sudo mysql_secure_installation 重置 root 密码。

Secure MariaDB in Debian 10

或者用以下方式:

  1. Login first with MySQL Command shell.
sudo mysql -u root -p
  1. Change the password as strong:
ALTER USER 'root'@'localhost' Identified by 'new-password';
  1. Execute the flush privileges:
FLUSH PRIVILEGES;

这种方式好一些, 不会出现不能访问的错误。

这样以后就可以通过

mysql -u root -p

并输入设置的数据库访问密码登录了。

相关文章

网友评论

      本文标题:Linux 系统怎么安装 MySQL

      本文链接:https://www.haomeiwen.com/subject/pfgifrtx.html