前言
昨天装了MySQL,发现以前的安装方法又不能用了。。。在折腾了一晚后,终于找到了一个适用于 MariaDB 10.5的教程。现在这里总结下。
教程
假设你要为安装类似 Typecho 的博客而配置数据库。
环境:
- 硬件:树莓派 3B
- 系统:RaspiOS 64位 Buster
安装 MySQL
sudo apt install default-mysql-server
设置 root 密码
root@raspberrypi:~ # sudo mysql -u root -p
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 296
Server version: 10.5.15-MariaDB-0+deb11u1 Debian 11
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and
others.
Type 'help;' or '\h' for help. Type '\c' to clear the curren
t input statement.
MariaDB [(none)]> alter user 'root'@'localhost' identified b
y 'Your_Password_Here';
Query OK, 0 rows affected (0.004 sec)
MariaDB [(none)]> flush privileges;
Query OK, 0 rows affected (0.004 sec)
注意:这里安装的版本应该为 MariaDB 10.4 或以上,例如我的是 10.5 。
创建数据库
CREATE DATABASE blog;
结尾
没有结尾