ssh pi@ip 地址 -p 22
ssh pi@192.168.1.116 -p 22
输入树莓派的密码后即可进入
sudo apt-get update
#sudo apt-get install mysql-server
sudo apt-get install mariadb-server
sudo mysql -u root
以空密码的方式登陆
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 2
Server version: 10.1.38-MariaDB-0+deb9u1 Raspbian 9.0
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)]>
无密码方式登录后进入 mysql
use mysql
查看插件配置
select plugin from user;
如果不是 mysql_native_password,更新 plugin
update user set plugin='mysql_native_password';
flush privileges;
exit;
进入 mysql 修改 root 密码为 raspberry
update user set password='raspberry' where user='root';
flush privileges;
exit;
重启 mysql
sudo /etc/init.d/mysql restart
以密码方式登录 mysql
sudo mysql -u root -p
回车后输入密码:raspberry,即可进入 mysql 数据库
修改 mysql 配置,树莓派默认没有 vim 只有 vi
sudo vi /etc/mysql/mariadb.conf.d/50-server.cnf
使用 #,将 bind-address 这行注释掉,然后重启
/etc/init.d/mysql restart
密码方式登录后进入 mysql,开启所有表的权限
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'raspberry' WITH GRANT OPTION;
flush privileges;
exit;
重启 mysql
/etc/init.d/mysql restart
https://www.cnblogs.com/pinsily/p/7906661.html
https://www.jianshu.com/p/95487b53cb84?from=timeline
https://www.cnblogs.com/apanly/p/9061803.html