deepin为什么apt-get install mysql安装的却是MariaDB?
Tofloor
poster avatar
无忧的小仓鼠
deepin
2019-08-09 21:24
Author
连接MariDB总是报错,很是烦人。安装后总是提示权限不足,命令行下加sudo可以连接(不加还连不上MariaDB),但是用Navicat(非root权限运行的)连接时总是提示权限不足,怎么办?
Reply Favorite View the author
All Replies
avatar
superendermansm
deepin
2019-08-09 21:46
#1
论坛搜索,有一个和你的标题一模一样的帖子
Reply View the author
avatar
152******80
Advanced Packager
2019-08-09 21:53
#2
sudo登录mariadb,
  1. update mysql.user set plugin='mysql_native_password' where user='root';
  2. update mysql.user set password=password("123456") where user='root';
  3. FLUSH PRIVILEGES;
Copy the Code

然后用普通账户登录,密码是上面设置的123456
Reply View the author
avatar
无忧的小仓鼠
deepin
2019-08-09 21:56
#3
找到了解决方式!
先卸载然后重新安装一下
apt-get autoremove --purge mysql-server-版本号
apt-get autoremove mysql-server
apt-get remove mysql-common
dpkg -l |grep ^rc|awk '{print $2}' |sudo xargs dpkg -P
卸载完成!

开始安装:
    sudo apt-get install mysql-server mysql-client
    查看密码:
        cat /etc/mysql/debian.cnf
    注意新安装的数据库密码为空!下面登录直接回车就行
        mysqk -u root -p

        use mysql;
        select host,user,plugin,authentication_string from user;
    更新密码:
    update user set plugin="mysql_native_password",authentication_string=password('Yjh123456`') where user="root";
    刷新权限
    FLUSH PRIVILEGES;

上面已经完成安装


更改数据库的编码,先登录数据库
    SHOW VARIABLES LIKE 'char%'; -- 显示数据编码
    CREATE DATABASE db_name DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;--设置新建数据库默认编码为utf8
Reply View the author
avatar
亚历山大一世
deepin
2019-08-10 03:14
#4
和mysql一样的
Reply View the author
avatar
Feng Yu
deepin
2019-08-10 03:32
#5
mysql 5.7授权方式改了,root默认必须使用unix domain socket连接。你需要去看官方文档了解详情
Reply View the author