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 @R_353_4045@ion 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)
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。