我是靠谱客的博主 开放水池,最近开发中收集的这篇文章主要介绍解决Deepin安装MySQL(MariaDB)密码为空且无法登录问题步骤,觉得挺不错的,现在分享给大家,希望可以做个参考。

概述

1.安装

sudo apt install mariadb-server mariadb-client

2.启动&关闭&启动mysql

# service mysql start
# service mysql stop
# service mysql start

3.所装MySQL密码为空,添加密码

root@X-PC# mysql
Welcome to the MariaDB monitor.  Commands end with ; or g.
Your MariaDB connection id is 49
Server version: 10.3.27-MariaDB-0+deb10u1 Debian 20

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or 'h' for help. Type 'c' to clear the current input statement.

MariaDB [(none)]> use mysql;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
MariaDB [mysql]> UPDATE mysql.user SET authentication_string = PASSWORD('此处写自己要设置的密码'), plugin = 'mysql_native_password' WHERE User = 'root' AND Host = 'localhost';
Query OK, 1 row affected (0.001 sec)
Rows matched: 1  Changed: 1  Warnings: 0

MariaDB [mysql]> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.001 sec)

MariaDB [mysql]> exit
Bye

4.关闭启动mysql

# service mysql stop
# service mysql start

5.命令行登录mysql,必须输入密码

root@X-PC# mysql
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
root@X-PC# mysql -uroot -p
Enter password: 
Welcome to the MariaDB monitor.  Commands end with ; or g.
Your MariaDB connection id is 12
Server version: 10.3.27-MariaDB-0+deb10u1 Debian 20

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or 'h' for help. Type 'c' to clear the current input statement.

MariaDB [(none)]> 

6.deepin安装MongoDB数据库必须参考官方文档安装步骤来装(中文网站上的安装步骤&资源过时,徒增浪费时间)

7.卸载软件例子

$ su root
# apt-get remove --purge mysql-*  
# apt-get autoremove mysql-server
# apt-get remove mysql-common
# dpkg -l |grep ^rc|awk '{print $2}' |sudo xargs dpkg -P

 

最后

以上就是开放水池为你收集整理的解决Deepin安装MySQL(MariaDB)密码为空且无法登录问题步骤的全部内容,希望文章能够帮你解决解决Deepin安装MySQL(MariaDB)密码为空且无法登录问题步骤所遇到的程序开发问题。

如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(50)

评论列表共有 0 条评论

立即
投稿
返回
顶部