[英]how can I use mysql while mariadb preinstalled?
我的命令
mysql -u root -p -h localhost -P 3306
它会显示
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 38
Server version: 10.1.24-MariaDB-6 Debian 9.0
Copyright (c) 2000, 2017, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
由于您在Debian 9上使用MariaDB 10.1.24,因此很有可能已从默认Debian存储库(而不是MariaDB存储库)安装了它。 Debian提供的软件包对本地root
使用unix_socket
身份验证 ,这意味着除非您是系统root
(直接或通过sudo
),否则您不能作为本地root
连接到服务器。 如果您是系统根用户,则不需要密码,它将被忽略。
如果是这样,您可以选择:
workbench
以使用它而不是root
-这是迄今为止最准确的方法,只要可以使workbench
从不使用root
; root@localhost
以使用密码身份验证-很容易做到,但是很可能会导致服务脚本,启动/关闭等问题,这些问题也需要进行更新,进而进行升级更复杂; root
使用密码身份验证。 它可能解决了您眼前的问题,但将使进一步的维护工作变得困难,并且从长远来看,该解决方案也不是很可靠,因为MariaDB软件包最终也可以切换到unix_socket
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.