Mysqladmin connect to server at localhost failed

8 udgru [2015-05-02 19:18:00]

Сегодня (2015-05-02) Я обновил свою систему Linux с помощью apt-get update и
apt-get upgrade, тогда как mysql, mysqladmin и намного больше пакетов
были обновлены. Выполняется mysql-server-5.5, и я могу войти и сделать все
типичные операции с базой данных, но когда я печатаю:

Я получаю следующую ошибку:

Раньше я мог решить эту проблему, просто установив новый пароль для пароля mysql. Это больше не решает проблему:

Как получить mysqladmin снова без переустановки mysql?

mysql ubuntu-14.04 mysqladmin

1 ответ

Краткая версия: если вашему пользователю MySQL root нужен пароль для подключения, может быть хорошей идеей, чтобы mysqladmin предоставил этот пароль;)

Более длинная версия: вашему пользователю MySQL root , кажется, нужен пароль для подключения

установка пароля пользователя mysql new

Но mysqladmin пытается подключиться без пароля

‘Доступ запрещен для пользователя’ root ‘@’ localhost ‘(с использованием пароля: НЕТ)’

И mysqladmin делает это, потому что вы не говорите об этом иначе;)

mysqladmin , как и другие инструменты командной строки, связанные с MySQL ( mysql , mysqldump , mysqlshow и т.д.), предлагает варианты предоставления таких данных доступа.

  • h : с каким хостом подключиться. Если не указано, localhost предполагается
  • u : Какой пользователь должен подключиться как. Если не указано, root предполагается
  • p : Какой пароль использовать. Если не указано, пароль не используется

Вы должны иметь возможность использовать что-то вроде

(помните, что между опциями и их значениями нет пробела). Вы также можете запросить у MySQL пароль, например

При этом MySQL должен дать вам подсказку, где вы можете ввести свой пароль.

Today (2015-05-02) I upgraded my Linux system via apt-get update and
apt-get upgrade whereas mysql, mysqladmin and a lot more packages
have been updated. The mysql-server-5.5 runs and I can login and do all
the typical database operations but when I type:

Читайте также:  Php перейти на другую страницу

I get the following error:

Formerly I could solve this issue by simple setting the mysql root password new.
This does not solve the issue anymore:

How do I get the mysqladmin up again without reinstalling mysql?

1 Answer 1

Short version: If your MySQL user root needs a password to connect, it might be a good idea to have mysqladmin provide that password 😉

Longer version: Your MySQL user root seems to need a password to connect

setting the mysql root password new

But mysqladmin tries to connect without a password

‘Access denied for user ‘root’@’localhost’ (using password: NO)’

And mysqladmin does that because you’re not telling it otherwise 😉

mysqladmin , like other MySQL-related command line tools ( mysql , mysqldump , mysqlshow etc.), offers options to provide such access data.

  • h : Which host to connect to. If not provided, localhost is assumed
  • u : Which user to connect as. If not provided, root is assumed
  • p : Which password to use. If not provided, no password is used

You should be able to use something like

(be aware that there’s no space between the options and their values). You can also have MySQL ask you for the password like

With that, MySQL should give you a prompt where you can enter your password.

Welcome to LinuxQuestions.org, a friendly and active Linux Community.

You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!

Читайте также:  Titan dc k8k925z n

Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.

Are you new to LinuxQuestions.org? Visit the following links:
Site Howto | Site FAQ | Sitemap | Register Now

If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.

Having a problem logging in? Please visit this page to clear all LQ-related cookies.

Introduction to Linux — A Hands on Guide

This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter. For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author’s experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.

Rate this post

Добавить комментарий

Ваш адрес email не будет опубликован. Обязательные поля помечены *