今天分享给大家这个教程,教大家如何在盒子里安装mysql数据库,这对很多博客或者网站主来说,非常有价值。
首先,安装mysql:
安装完毕增加root用户和权限:sudo apt-get update
sudo apt install mysql-server
先找到默认的debian用户:
sudo 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的密码进去,检查是否成功开启root用户ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '你的强密码';
GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION;
quit
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 就可以登录管理里了。欢迎投稿(技术分享、原创教程)至本站机器人: blog#mige.eu.org
Subscribe by Email
Follow Updates Articles from This Blog via Email
No Comments