树莓派安装MySQL数据库与卸载

出处:

1、http://www.cnblogs.com/liyangLife/p/4500115.html

2、https://blog.csdn.net/huayucong/article/details/49736427

3、https://www.imooc.com/article/23132?block_id=tuijian_wz

4、http://www.runoob.com/mysql/mysql-install.html(Debian系统)

5、https://blog.csdn.net/faryang/article/details/50788795(树莓派系统)

删除mysql:

sudo apt-ge autoremove --purge mysql-server

sudo apt-get remove mysqyl-server

sudo apt-get autoremove mysql-server

sudo apt-get remove mysql-common //重要

清除残留数据

dpkg -l |grep ^rc|awk '{print $2}' |sudo xargs dpkg -P

安装Mysql软件

 

sudo apt-get install mysql-server
sudo apt-get install mysql-client

sudo apt-get install mysql-server python-mysqldb //安装python接口的mysql

 

测试:

没有找到bind_address信息

安装正常后,设置防火墙时,port 22端口没有开启成功,结果reboot树莓派后,不能ssh登陆了,尴尬,

重新ufw allow 22端口后,才可以登陆ssh。

再次使用Mysql时,

Mysql -u root -p

出现“mysql access denied for user 'root'@'localhost' ”

幸好找到方法:

step 1 ://首先停止当前的mysql服务: /etc/init.d/mysql stop (service mysqld stop )

step 2: //设置Mysql免密登录,等同恢复初始时的状态 (  ̄  ̄)σ…( _ _)ノ|壁 sudo mysqld_safe --skip-grant-tables&

step 3: //另外开个终端: //进入mysql并且以root账户进入“mysql”数据库 

sudo mysql --user=root mysql update user set Password=PASSWORD('new-password'); 

flush privileges;

exit; 

 

posted @ 2019-04-04 21:48  滤v镜  阅读(305)  评论(0编辑  收藏  举报