读徒 命里有时终须有,命里无时莫强求

盒子NAS系统安装mysql数据库

2024-10-15
lhlloveqq

首先,安装mysql:

sudo apt-get update
sudo apt install mysql-server

安装完毕增加root用户和权限: 先找到默认的debian用户: s

udo cat /etc/mysql/debian.cnf
ubuntu@hi3798mv100:~$ sudo cat /etc/mysql/debian.cnf
[client]
host = localhost
user = debian-sys-maint
password = XGIsmI4ihbiqf7Wi
socket = /var/run/mysqld/mysqld.sock
[mysql_upgrade]
host = localhost
user = debian-sys-maint
password = XGIsmI4ihbiqf7Wi
socket = /var/run/mysqld/mysqld.sock

此处输入图片的描述

此时已默认debian账号先行进入mysql后台, 进行添加root用户的操作 sudo mysql -u debian-sys-maint -p 输入上面查看到的password的密码进去,

ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '你的强密码';
GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION;

quit 检查是否成功开启root用户

sudo mysql -u root -p

quit退出

其次安装phpmyadmin管理工具

sudo apt install phpmyadmin php-mbstring php-zip php-gd php-json php-curl

安装完后,为了在浏览器直接打开,我们要把工具软链接放在网站目录下:

sudo ln -s /usr/share/phpmyadmin /var/www/html/phpmyadmin

然后你打开网站http://192.168.1.10/phpmyadmin 就可以登录管理里了。

下一篇教你怎么在盒子里安装flarum论坛程序。


Similar Posts

Comments