# 更新一下aptapt update && apt upgrade -y
# 初始化内容sudo apt install apt-transport-https curl
sudo mkdir -p /etc/apt/keyrings
sudo curl -o /etc/apt/keyrings/mariadb-keyring.pgp 'https://mariadb.org/mariadb_release_signing_key.pgp'# apt没有自带mariadb需要写入存储库vim /etc/apt/sources.list.d/mariadb.sources
# 写入以下内容# MariaDB 10.11 repository list - created 2024-06-15 06:06 UTC# [https://mariadb.org/download/](https://mariadb.org/download/)X-Repolib-Name: MariaDB
Types: deb
# deb.mariadb.org is a dynamic mirror if your preferred mirror goes offline. See [https://mariadb.org/mirrorbits/](https://mariadb.org/mirrorbits/) for details.# URIs: [https://deb.mariadb.org/10.11/debian](https://deb.mariadb.org/10.11/debian)URIs: [https://mirrors.xtom.com/mariadb/repo/10.11/debian](https://mirrors.xtom.com/mariadb/repo/10.11/debian)Suites: bookworm
Components: main
Signed-By: /etc/apt/keyrings/mariadb-keyring.pgp
# 阿里云的源# MariaDB 10.11 repository list - created 2024-08-01 14:43 UTC# [https://mariadb.org/download/](https://mariadb.org/download/)X-Repolib-Name: MariaDB
Types: deb
# deb.mariadb.org is a dynamic mirror if your preferred mirror goes offline. See [https://mariadb.org/mirrorbits/](https://mariadb.org/mirrorbits/) for details.# URIs: [https://deb.mariadb.org/10.11/debian](https://deb.mariadb.org/10.11/debian)URIs: [https://mirrors.aliyun.com/mariadb/repo/10.11/debian](https://mirrors.aliyun.com/mariadb/repo/10.11/debian)Suites: bookworm
Components: main
Signed-By: /etc/apt/keyrings/mariadb-keyring.pgp
# 开始安装:sudo apt update
sudo apt install mariadb-server
# 安装完成以后开始初始化mysql_secure_installation
Enter current password for root (enter for none): # 当前的root 密码 默认root密码为空直接回车即可Switch to unix_socket authentication [Y/n]#是否使用unix_socket验证,建议否Set root password? [Y/n]#是否设置新的root密码New password: #输入新密码Re-enter new password: #确认密码Remove anonymous users? [Y/n]#是否移除匿名用户Disallow root login remotely? [Y/n]#是否启用root用户的远程访问Remove test database and access to it? [Y/n]#是否删除测试数据库Reload privilege tables now? [Y/n]#是否立即刷新数据库配置Thanks for using MariaDB!
开启远程访问
1
2
# 登录mysql
1
2
3
4
grant all privileges on *.* to root@"%" identified by "pwd" with grant option; flush privileges;grant all privileges on *.* to gitea@"%" identified by "123" with grant option;