日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 运维知识 > 数据库 >内容正文

数据库

树莓派要mysql的密码_树莓派raspberry Pi 3B+系统中安装mysql过程中不提示输入密码,安装完后如何设置密码...

發布時間:2023/12/10 数据库 28 豆豆
生活随笔 收集整理的這篇文章主要介紹了 树莓派要mysql的密码_树莓派raspberry Pi 3B+系统中安装mysql过程中不提示输入密码,安装完后如何设置密码... 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

樹莓派raspberry Pi 3B+安裝mysql未提示輸入密碼,安裝后修改mysql密碼默認密碼

使用mysql -uroot -p 命令連接mysql時,報錯

pi@raspberrypi:/ $ mysql -uroot -p

Enter password:

ERROR1698 (28000): Access denied for user 'root'@'localhost'

按照網上的說法,

1.進入到etc/mysql 目錄下,查看debian.cnf文件,使用默認的用戶名和密碼登錄

pi@raspberrypi:/etc/mysql $ sudo cat debian.cnf#Automatically generated for Debian scripts. DO NOT TOUCH!

[client]

host=localhost

user=root

password=socket= /var/run/mysqld/mysqld.sock

[mysql_upgrade]

host=localhost

user=root

password=socket= /var/run/mysqld/mysqld.sock

basedir= /usr

結果是默認密碼是空,多次嘗試不成功,依然報錯。

最后輸入:sudo mysql -uroot(使用root身份免密碼登錄,一定要sudo,不要輸入-p??? 否則進不去,我就是嘗試多次,不成功)

終于進入系統

pi@raspberrypi:/ $ sudo mysql -uroot

Welcome to the MariaDB monitor. Commands end with ;or\g.

Your MariaDB connection idis 5Server version:10.1.37-MariaDB-0+deb9u1 Raspbian 9.0Copyright (c)2000, 2018, Oracle, MariaDB Corporation Ab andothers.

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

MariaDB [(none)]>

原來系統用的mysql的版本是MariaDB,是mysql的一個主要分支,但是它全面兼容mysql。

后續的操作按照網上介紹的內容繼續操作:

MariaDB [(none)]>show databases;+--------------------+

| Database |

+--------------------+

| information_schema |

| mysql |

| performance_schema |

+--------------------+

3 rows in set (0.01 sec)

然后使用use mysql; 命令打開數據庫。

MariaDB [(none)]> use mysql;

MariaDB [mysql]> update user set authentication_string=("你要設置的密碼") where user='root';

Query OK,1 row affected (0.00sec)

Rows matched:1 Changed: 1Warnings: 0

MariaDB [mysql]> update user set plugin="mysql_native_password";

Query OK,1 row affected (0.00sec)

Rows matched:1 Changed: 1Warnings: 0

MariaDB [mysql]>flush privileges;

Query OK, 0 rows affected (0.00sec)

MariaDB [mysql]>quit;

Bye

重啟樹莓派正常登錄

此方法也使用與Ubuntu16以上的版本。

總結

以上是生活随笔為你收集整理的树莓派要mysql的密码_树莓派raspberry Pi 3B+系统中安装mysql过程中不提示输入密码,安装完后如何设置密码...的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。