树莓派安装mysql

首先我想启用root用户,所以我先启用root用户:

sudo passwd root

这里会提示输入两次密码,然后:

sudo passwd --unlock root

这样就可以启动root登录,如果想立马使用root,可以:

su root

这样就可以直接切换到root用户不过会提示输入密码,如果下次用root登录的话就会在登录的时候显示设置画面,如果你只是玩玩就可以不用管这个。

接下来要安装mysql,安装之前可以先更新下本机软件:

sudo apt-get update

然后就是等待了。等待完之后要准备安装mysql了,命令直接安装:

sudo apt-get install mysql-server

然后就是等待,在安装的过程中会提示你让你输入mysql的root密码,会提示两次。输入完成之后就会安装成功了。

然后输入如下命令进入mysql:

mysql -u root -p

然后会提示输入密码,输入密码就可以进入mysql:

 1 root@raspberrypi:/home/pi# mysql -u root -p
 2 Enter password:
 3 Welcome to the MySQL monitor.  Commands end with ; or g.
 4 Your MySQL connection id is 43
 5 Server version: 5.5.35-0+wheezy1 (Debian)
 6 
 7 Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
 8 
 9 Oracle is a registered trademark of Oracle Corporation and/or its
10 affiliates. Other names may be trademarks of their respective
11 owners.
12 
13 Type 'help;' or 'h' for help. Type 'c' to clear the current input statement.
14 
15 mysql>
原文地址:https://www.cnblogs.com/jsben/p/4761901.html