树莓派安装MySQL

树莓派安装MySQL,第1张

输入 root的 密码

1. 安装MySQL

使用管理员权限运行apt-get获取最新的MySQL及Python编程接口(之后用于数据库编程):

$ sudo apt-get install mysql-server python-mysqldb

安装过程中需要输入root管理员的密码,该密码之后用于访问数据库系统。

2. 测试MySQL

通过以下命令运行MySQL的唤禅命令提示系统,并输入在安装过程中设置的密码:

mysql -u root -pEnter password:Welcome to the MySQL monitor. Commands end with or \g.Your MySQL connection id is 47Server version: 5.5.41-0+wheezy1 (Debian)Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.Oracle is a registered trademark of Oracle Corporation and/or its

affiliates. Other names may be trademarks of their respective

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

查看当前已建立的数据库:

mysql>首历 SHOW DATABASES+--------------------+| Database |+--------------------+| information_schema || mysql || performance_schema |+--------------------+

rows in set (0.00 sec)

3. 创建一个新的数据库和表单

以上数据库都是系统建立和芹尘的数据库,要想开始插入数据,首先需要建立新的数据库和表单。这里假设要实现一个CPU温度记录的功能,存放在名为"sensordb"的数据库中。使用以下命令建立数据库:

mysql>CREATE DATABASE sensordbQuery OK, 1 row affected (0.00 sec)

查看数据库是否建立成功:

mysql>SHOW databases+--------------------+| Database |+--------------------+| information_schema || mysql || performance_schema || sensordb |+--------------------+

rows in set (0.01 sec)

载命令蚂御搜: sudo apt-get purge mysql-server-5.5 rm -rf /var/lib/拆巧mysql 设置安全账户命令,给root增加密码,禁用匿名用户等。。。 mysql_secure_installation root用户登陆mysql命令 mysql -uroot -p 安装音频驱闷历动: sudo apt-get install alsa-utils sudo modprobe snd_bcm2835


欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/tougao/12411961.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-05-25
下一篇 2023-05-25

发表评论

登录后才能评论

评论列表(0条)

保存