时间:2021-07-01 10:21:17 帮助过:55人阅读
执行上面 SQL 的意图是,创建一个用户,为用户赋权。
如果你现在进行远程连接 MariaDB / MySQL 的时候,你会收到连接 10061 的错误。
按照我们前面的提示,这是因为绑定的问题。
旧版本的MySQL修改/etc/mysql/my.cnf文件,修改内容相同。
如果你的服务上的版本没有这个文件的话,新版本的服务器,你需要修改:
/etc/mysql/mariadb.conf.d/50-server.cnf 这个文件。
注释掉 ’bind-address
必要的话,可以尝试重启服务器。
重启服务器的命令是:
root@raspberrypi:~# service mariadb restart
查看数据库服务器进程是是否运行的命令是:
service mariadb status
如果服务器输出下面的信息,表示服务器已经运行了,你可以尝试使用 Client 远程进行连接了。
root@raspberrypi:~# service mariadb status ● mariadb.service - MariaDB 10.3.22 database server Loaded: loaded (/lib/systemd/system/mariadb.service; enabled; vendor preset: enabled) Active: active (running) since Sun 2020-04-05 10:57:14 EDT; 11s ago Docs: man:mysqld(8) https://mariadb.com/kb/en/library/systemd/ Process: 1691 ExecStartPre=/usr/bin/install -m 755 -o mysql -g root -d /var/run/mysqld (code=exited, status=0/SUCCESS) Process: 1692 ExecStartPre=/bin/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, status=0/SUCCESS) Process: 1694 ExecStartPre=/bin/sh -c [ ! -e /usr/bin/galera_recovery ] && VAR= || VAR=`/usr/bin/galera_recovery`; [ $? -eq 0 ] && systemctl set-environment _WSREP_START_POSITION=$VAR || exit 1 (code=exited, status=0/SUCCESS Process: 1771 ExecStartPost=/bin/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, status=0/SUCCESS) Process: 1773 ExecStartPost=/etc/mysql/debian-start (code=exited, status=0/SUCCESS) Main PID: 1740 (mysqld) Status: "Taking your SQL requests now..." Tasks: 31 (limit: 4035) Memory: 47.7M CGroup: /system.slice/mariadb.service └─1740 /usr/sbin/mysqld Apr 05 10:57:13 raspberrypi systemd[1]: Starting MariaDB 10.3.22 database server... Apr 05 10:57:14 raspberrypi mysqld[1740]: 2020-04-05 10:57:14 0 [Note] /usr/sbin/mysqld (mysqld 10.3.22-MariaDB-0+deb10u1) starting as process 1740 ... Apr 05 10:57:14 raspberrypi systemd[1]: Started MariaDB 10.3.22 database server. Apr 05 10:57:14 raspberrypi /etc/mysql/debian-start[1775]: Upgrading MySQL tables if necessary. Apr 05 10:57:14 raspberrypi /etc/mysql/debian-start[1778]: /usr/bin/mysql_upgrade: the ‘--basedir‘ option is always ignored Apr 05 10:57:14 raspberrypi /etc/mysql/debian-start[1778]: Looking for ‘mysql‘ as: /usr/bin/mysql Apr 05 10:57:14 raspberrypi /etc/mysql/debian-start[1778]: Looking for ‘mysqlcheck‘ as: /usr/bin/mysqlcheck Apr 05 10:57:14 raspberrypi /etc/mysql/debian-start[1778]: This installation of MySQL is already upgraded to 10.3.22-MariaDB, use --force if you still need to run mysql_upgrade Apr 05 10:57:14 raspberrypi /etc/mysql/debian-start[1786]: Checking for insecure root accounts. Apr 05 10:57:14 raspberrypi /etc/mysql/debian-start[1790]: Triggering myisam-recover for all MyISAM tables and aria-recover for all Aria tables
另外,你可以查看 MariaDB 运行的端口:
MariaDB [(none)]> SHOW GLOBAL VARIABLES LIKE ‘port‘; +---------------+-------+ | Variable_name | Value | +---------------+-------+ | port | 3306 | +---------------+-------+ 1 row in set (0.004 sec) MariaDB [(none)]>
https://www.cwiki.us/questions/57938848
RaspberryPi(树莓派)如何安装 MariaDB / MySQL 数据库
标签:nload 一个 osi air cgroup mairadb jpg create ready