debian10 arm64架构下安装mysql或者mariadb
mysql官方没有提供arm64架构的安装源 需要安装mysql的请查看这篇博客
【树莓派安装mysql5.7】 https://linuxer.top/archives/raspi-install-mysql57.html
我本地安装了 mariadb 为了省事,
下面是按照步骤
1,更新软件包
sudo apt update
2,安装Mariadb服务端
sudo apt install mariadb-server
3,安装完成后查看安装情况
sudo systemctl status mariadb
或者
service mariadb status
输出一下内容
mariadb.service - MariaDB 10.3.27 database server Loaded: loaded (/lib/systemd/system/mariadb.service; enabled; vendor preset: enabled) Active: active (running) since Thu 2021-03-01 14:36:28 PDT; 19min ago Docs: man:mysqld(8) https://mariadb.com/kb/en/library/systemd/ Main PID: 4509 (mysqld) Status: "Taking your SQL requests now..." Tasks: 30 (limit: 2359) Memory: 78.6M CGroup: /system.slice/mariadb.service └─4509 /usr/sbin/mysqld
4,基本配置
sudo mysql_secure_installation
脚本执行过程中,系统将提示您为 root 帐户设置密码,删除匿名用户,限制 root 用户对本地计算机的访问权限并删除测试数据库
类似如下:
... Enter current password for root (enter for none): ... Set root password? [Y/n] Y New password: Re-enter new password: ... Remove anonymous users? [Y/n] Y ... Disallow root login remotely? [Y/n] Y ... Remove test database and access to it? [Y/n] Y ... Reload privilege tables now? [Y/n] Y ... Thanks for using MariaDB!
连接测试
mysql -u root -p
5,配置root远程访问
nano /etc/mysql/mariadb.conf.d/50-server.cnf
修改如下:
bind-address = 0.0.0.0 #bind-address改为0.0.0.0,从而可以外网访问
6,配置权限
-> # mysql -h localhost -P 3306 -u root -p
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 30
Server version: 10.1.38-MariaDB-0ubuntu0.18.04.1 Ubuntu 18.04
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]> use mysql;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
MariaDB [mysql]> select user,host,password from user;
+------+-----------+-------------------------------------------+
| user | host | password |
+------+-----------+-------------------------------------------+
| root | localhost | *1945EC0A6D14A304922B91B7F14585A0B75D12 |
+------+-----------+-------------------------------------------+
1 row in set (0.02 sec)
MariaDB [mysql]> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '123123' WITH GRANT OPTION;
Query OK, 0 rows affected (0.23 sec)
MariaDB [mysql]> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.01 sec)
MariaDB [mysql]> select user,host,password from user;
+------+-----------+-------------------------------------------+
| user | host | password |
+------+-----------+-------------------------------------------+
| root | localhost | *194500000000ECA6D000000000000585AB7E5D12 |
| root | % | *2470C0C06DEE41618BB00000000000000EC9DE19 |
+------+-----------+-------------------------------------------+
2 rows in set (0.04 sec)