显然清除和/或重新安装mysql
并mariadb
可能导致冲突,因此尝试:
root@mordor:~#
root@mordor:~# sudo apt purge mariadb-server mariadb-client mysql-client mysql-server
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package 'mysql-client' is not installed, so not removed
Package 'mysql-server' is not installed, so not removed
The following packages will be REMOVED:
mariadb-client* mariadb-server*
0 upgraded, 0 newly installed, 2 to remove and 1 not upgraded.
After this operation, 20.5 kB disk space will be freed.
Do you want to continue? [Y/n] y
(Reading database ... 181581 files and directories currently installed.)
Removing mariadb-client (1:10.4.17+maria~focal) ...
Removing mariadb-server (1:10.4.17+maria~focal) ...
root@mordor:~#
root@mordor:~#
root@mordor:~# rm -rf /var/lib/mysql
root@mordor:~#
root@mordor:~# sudo apt install mariadb-client mariadb-server
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
mariadb-client mariadb-server
0 upgraded, 2 newly installed, 0 to remove and 1 not upgraded.
Need to get 0 B/6252 B of archives.
After this operation, 20.5 kB of additional disk space will be used.
Selecting previously unselected package mariadb-client.
(Reading database ... 181576 files and directories currently installed.)
Preparing to unpack .../mariadb-client_1%3a10.4.17+maria~focal_all.deb ...
Unpacking mariadb-client (1:10.4.17+maria~focal) ...
Selecting previously unselected package mariadb-server.
Preparing to unpack .../mariadb-server_1%3a10.4.17+maria~focal_all.deb ...
Unpacking mariadb-server (1:10.4.17+maria~focal) ...
Setting up mariadb-client (1:10.4.17+maria~focal) ...
Setting up mariadb-server (1:10.4.17+maria~focal) ...
root@mordor:~#
root@mordor:~# mariadb
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
root@mordor:~#
root@mordor:~# systemctl status mariadb.service
● mariadb.service - MariaDB 10.4.17 database server
Loaded: loaded (/lib/systemd/system/mariadb.service; enabled; vendor preset: enabled)
Drop-In: /etc/systemd/system/mariadb.service.d
└─migrated-from-my.cnf-settings.conf
Active: failed (Result: exit-code) since Sat 2020-11-14 10:43:31 PST; 1h 23min ago
Docs: man:mysqld(8)
https://mariadb.com/kb/en/library/systemd/
Main PID: 90075 (code=exited, status=1/FAILURE)
Status: "MariaDB server is down"
Nov 14 10:43:29 mordor systemd[1]: Starting MariaDB 10.4.17 database server...
Nov 14 10:43:29 mordor mysqld[90075]: 2020-11-14 10:43:29 0 [Note] /usr/sbin/mysqld (mysqld 10.4.17-MariaDB-1:10.4.17+maria~focal-l>
Nov 14 10:43:29 mordor mysqld[90075]: 2020-11-14 10:43:29 0 [Warning] Could not increase number of max_open_files to more than 1638>
Nov 14 10:43:29 mordor mysqld[90075]: 2020-11-14 10:43:29 0 [Warning] Changed limits: max_open_files: 16384 max_connections: 500 (>
Nov 14 10:43:31 mordor systemd[1]: mariadb.service: Main process exited, code=exited, status=1/FAILURE
Nov 14 10:43:31 mordor systemd[1]: mariadb.service: Failed with result 'exit-code'.
Nov 14 10:43:31 mordor systemd[1]: Failed to start MariaDB 10.4.17 database server.
root@mordor:~#
我该如何开始mariadb
?我可以再次清除它,但这只是一个循环。
第一次检查 mariadb 是否正在运行。如果不是,您将无法连接到它。
你忘了做
设置用户和密码。
关于这个命令也请...
通常你也可以这样做:
然后设置用户和密码。尽量避免使用通用名称作为用户(即 no
root
、admin
、您的用户名等)并使用个人用户名。它使它成为人们需要猜测的另一件事。至少可以进入数据库:
或作为普通用户: