当前位置: 首页 > 知识库问答 >
问题:

MariaDB在Ubuntu 15.04上没有检查密码

宋畅
2023-03-14

我在服务器上安装了Ubuntu服务器15.04和MariaDB 10.0.17。

安装MariaDB时,我看不到密码设置页面,安装完成。

所以我尝试使用SET password和UPDATE table来更改我的根密码。

但是,没有发生。

我可以使用任何密码和无密码访问MySQL
像这样:

root@kuroneko-Server:~# mysql -uroot -p
Enter password: [Type 'itsnotpassword']
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 34
Server version: 10.0.17-MariaDB-0ubuntu1 (Ubuntu)

Copyright (c) 2000, 2015, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]>



我已经尝试刷新权限;并重新启动mysql服务
重新安装ubuntu,重新安装mariadb。。。等

服务mysql状态:

root@kuroneko-Server:~# service mysql status
● mysql.service - LSB: Start and stop the mysql database server daemon
   Loaded: loaded (/etc/init.d/mysql)
   Active: active (running) since 금 2015-05-22 11:17:41 EDT; 34min ago
     Docs: man:systemd-sysv-generator(8)
  Process: 8127 ExecStop=/etc/init.d/mysql stop (code=exited, status=0/SUCCESS)
  Process: 8158 ExecStart=/etc/init.d/mysql start (code=exited, status=0/SUCCESS)
   CGroup: /system.slice/mysql.service
           ├─8183 /bin/bash /usr/bin/mysqld_safe
           ├─8184 logger -p daemon.err -t /etc/init.d/mysql -i
           └─8338 /usr/sbin/mysqld --basedir=/usr --datadir=/var/lib/mysql --plugin-dir=/usr/lib/mysql/plugin --user=mysql --log-error=/var/log/mysql/error.log --pid-file=/var/run/mysqld/mysqld.pid --socket=/var/run/mysqld/mysqld.sock --port=3306

 5월 22 11:17:40 kuroneko-Server systemd[1]: Starting LSB: Start and stop the mysql database server daemon...
 5월 22 11:17:40 kuroneko-Server mysql[8158]: * Starting MariaDB database server mysqld
 5월 22 11:17:41 kuroneko-Server mysql[8158]: ...done.
 5월 22 11:17:41 kuroneko-Server systemd[1]: Started LSB: Start and stop the mysql database server daemon.


马里亚布设置。

[mysqld]
#
# * Basic Settings
#
user            = mysql
pid-file        = /var/run/mysqld/mysqld.pid
socket          = /var/run/mysqld/mysqld.sock
port            = 3306
basedir         = /usr
datadir         = /var/lib/mysql
tmpdir          = /tmp
lc-messages-dir = /usr/share/mysql
skip-external-locking

# Instead of skip-networking the default is now to listen only on
# localhost which is more compatible and is not less secure.
bind-address            = 127.0.0.1

#
# * Fine Tuning
#
key_buffer              = 16M
max_allowed_packet      = 16M
thread_stack            = 192K
thread_cache_size       = 8
# This replaces the startup script and checks MyISAM tables if needed
# the first time they are touched
myisam-recover         = BACKUP
#max_connections        = 100
#table_cache            = 64
#thread_concurrency     = 10

#
# * Query Cache Configuration
#
query_cache_limit       = 1M
query_cache_size        = 16M

#
# * Logging and Replication
#
# Both location gets rotated by the cronjob.
# Be aware that this log type is a performance killer.
# As of 5.1 you can enable the log at runtime!
#general_log_file        = /var/log/mysql/mysql.log
#general_log             = 1
#
# Error log - should be very few entries.
#
log_error = /var/log/mysql/error.log
#
# Here you can see queries with especially long duration
#log_slow_queries       = /var/log/mysql/mysql-slow.log
#long_query_time = 2
#log-queries-not-using-indexes
#
# The following can be used as easy to replay backup logs or for replication.
# note: if you are setting up a replication slave, see README.Debian about
#       other settings you may need to change.
#server-id              = 1
#log_bin                        = /var/log/mysql/mysql-bin.log
expire_logs_days        = 10
max_binlog_size   = 100M
#binlog_do_db           = include_database_name
#binlog_ignore_db       = include_database_name

#
# * InnoDB
#
# InnoDB is enabled by default with a 10MB datafile in /var/lib/mysql/.
# Read the manual for more InnoDB related options. There are many!

#
# * Security Features
#
# Read the manual, too, if you want chroot!
# chroot = /var/lib/mysql/
#
# For generating SSL certificates I recommend the OpenSSL GUI "tinyca".
#
# ssl-ca=/etc/mysql/cacert.pem
# ssl-cert=/etc/mysql/server-cert.pem
# ssl-key=/etc/mysql/server-key.pem

#
# * Character sets
#
# Default is Latin1, if you need UTF-8 set all this (also in client section)
#
character-set-server  = utf8
collation-server      = utf8_general_ci
character_set_server   = utf8
collation_server       = utf8_general_ci

#
# * Unix socket authentication plugin
#
# Needed so the root database user can authenticate without a password but
# only when running as the unix root user.
#
# Also available for other users if required.
# See https://mariadb.com/kb/en/unix_socket-authentication-plugin/
plugin-load-add         = auth_socket.so


有人知道这件事吗?

我找不到关于这个问题的任何信息。

共有3个答案

莘聪
2023-03-14

MariaDB 10.0.17无法使用非root用户访问root
(包括网络访问)

任何人都可以通过ubuntu root用户访问MariaDB root
(非认证)

所以,让新的root2用户在web上管理mysql。

张嘉熙
2023-03-14

答案就在您的配置文件中

#
# * Unix socket authentication plugin
#
# Needed so the root database user can authenticate without a password but
# only when running as the unix root user.
#
# Also available for other users if required.
# See https://mariadb.com/kb/en/unix_socket-authentication-plugin/
plugin-load-add         = auth_socket.so

身份验证套接字。因此,当您是root用户时,可以在没有密码提示的情况下登录。因此,理想情况下,只需键入“mysql”即可登录

燕钟展
2023-03-14

见:http://ubuntuforums.org/showthread.php?t=2275033

并执行以下sql:

USE mysql; 

UPDATE user 
SET password=PASSWORD('NEW_PASSWORD'), 
    plugin='' 
WHERE user='root';

FLUSH PRIVILEGES;

PS:出于安全考虑,在root用户上设置了plugin字段,以防止非root用户登录。因此,取消该插件将起作用。

 类似资料:
  • 我尝试了重置根密码的建议,因为mariadb不起作用

  • 问题内容: 我知道可以用来从外壳检查给定的二进制文件,但是有可能在一个进程中执行此操作吗? 类似于(我完全组成了系统调用): 我正在尝试在我们的代码库中诊断一些可疑的SO链接问题,并且希望在可能的情况下以这种方式检查RPATH(我宁愿不必生成外部脚本)。 问题答案:

  • 161213 14:01:16[注意]/usr/libexec/mysqld:关闭完成 161213 14:01:16 mysqld_safe mysqld从pid文件/var/run/mariadb/mariadb.pid结束

  • 我试图检查密码,我加密之前,但我得到一个例外,我不知道为什么。 这里是我用来加密密码的方法: 加密工作成功。 此处为错误日志: 有什么想法吗?感谢你的帮助.

  • 问题内容: 如何编写脚本在Ubuntu上安装MySQL服务器? 将安装,但同时还会要求您在控制台中输入密码。 如何以非交互方式进行此操作?也就是说,写一个可以提供密码的脚本吗? 问题答案: 对于特定版本,例如,您需要像这样指定版本: 对于mysql-community-server,密钥略有不同: 将your_password替换为所需的root密码。(似乎your_password也可以留空以获

  • 我研发的App使用了一些JWT令牌,而不是它生成的。到目前为止,我存储令牌,并严格比较头中给出的令牌和我在数据库中得到的令牌。 我找到的所有JWT PHP库都按以下顺序显示示例: 使用密钥ky生成令牌 我需要检查JWT是否有效(关于标头、有效负载和给定的签名),这将增加一个安全层。 在没有密钥的情况下,我如何“简单”地检查令牌完整性?