安装mariadb
apt-get install -y mariadb-server
更改root密码
mysql_secure_installation
重启
systemctl restart mariadb
开机自启动
systemctl enable mariadb
建库
登录mysql
mysql -u root
CREATE DATABASE nextcloud;
CREATE USER 'oc_next'@'localhost' IDENTIFIED BY "123456";
GRANT ALL PRIVILEGES ON nextcloud.* TO 'oc_next'@'localhost';
grant all privileges on nextcloud.* to 'oc_next'@'%' identified by '123456' with grant option;
FLUSH PRIVILEGES;
开放远程连接
vi /etc/mysql/mariadb.conf.d/50-server.cnf
修改绑定IP127.0.0.1为0.0.0.0
开放防火墙
ufw allow 3306