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)

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM