Deep Linux 安装Mariadb数据库

DeepLinux下安装MariaDB

1、通过DeepLinux的应用商店安装“新立得软件包管理器”,运行“新立得软件包管理器”,搜索“MariaDB”选择MariaDB-server,进行安装。也可以bash下通过 sudo apt install mariadb-server 安装。

Deep Linux 安装Mariadb数据库

2、改密码

 sudo systemctl start mariadb(或mysql)启动服务

(base) [email protected]:~$ sudo mysqladmin -uroot -p password
Enter password: 
这里输入你设定的密码。

3、还有一个方法mysql_secure_installation这个命令:

(base) [email protected]:~$ mysql_secure_installation

NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
      SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!

In order to log into MariaDB to secure it, we'll need the current
password for the root user.  If you've just installed MariaDB, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.

Enter current password for root (enter for none): 
这里输入当前密码,然后 再输入新密码。

4、忘记Root密码后修改的方法 

先要停止服务 sudo systemctl stop mariadb(mysql)

然后

(base) [email protected]:~$sudo  mysqld_safe --skip-grant-tables

(base) [email protected]:~$sudo mysql -u root   就可以不用密码直接登录。