Mysql 3306 error

There are two types of errors  which occur in MySql are as follows:- Another instance is already running:- This error occurs when MySql has been installed by you in command-line...

Slide 1

Most trusted JOB oriented professional program

DevOps Certified Professional (DCP)

Take your first step into the world of DevOps with this course, which will help you to learn about the methodologies and tools used to develop, deploy, and operate high-quality software.

Slide 2

DevOps to DevSecOps – Learn the evolution

DevSecOps Certified Professional (DSOCP)

Learn to automate security into a fast-paced DevOps environment using various open-source tools and scripts.

Slide 2

Get certified in the new tech skill to rule the industry

Site Reliability Engineering (SRE) Certified Professional

A method of measuring and achieving reliability through engineering and operations work – developed by Google to manage services.

Slide 2

Master in DevOps Engineering (MDE)

Get enrolled for the most advanced and only course in the WORLD which can make you an expert and proficient Architect in DevOps, DevSecOps and Site Reliability Engineering (SRE) principles together.

Slide 2

Gain expertise and certified yourself

Azure DevOps Solutions Expert

Learn about the DevOps services available on Azure and how you can use them to make your workflow more efficient.

Slide 3

AWS Certified DevOps Professional

Learn about the DevOps services offered by AWS and how you can use them to make your workflow more efficient.

previous arrow

next arrow

There are two types of errors  which occur in MySql are as follows:-

  1. Another instance is already running:- This error occurs when MySql has been installed by you in command-line (cmd) before installing XAMPP server.
    ▪Open cmd and run as administrator
    ▪So, type this in command-line (cmd ) = “sc delete mysql”
    ▪It will show you that running instance has deleted succesfully.

2. MySql port 3306 already in use error:-
Often , this error occurs when  XAMPP or MAMP is used for  configuring to start MySQL and PHP on system startup and by default MySQL uses port 3306.
We have to change this port from old to new one like this :-
▪Firstly you have to open XAMPP Control Panel.
▪Just click MySql config button->click my.ini file
▪It will open in Notepad , after that u have to find and change port no from 3306 to 3307 in two places
▪ Save it. 

  • Author
  • Recent Posts

Usha Kiran

MySQL is one of the most widely used open source relational database management tool (RDMS) based on structured query language (SQL).

The most common error received while installing MySQL on the server and starting/restarting the MySQL service on a *nix server is:

[ERROR] Can't start server: Bind on TCP/IP port: Address already in use
[ERROR] Do you already have another mysqld server running on port: 3306 ?
[ERROR] Aborting

Looking at the above error, it seems to be an issue with the MySQL service running on the default port 3306.

Lets troubleshoot MySQL  service starting error considering different scenarios.

Scenario 1:

Step 1:

Check the MySQL service status by running below command:

/etc/init.d/mysqld status

Step 2:

If MySQL service is running then stop the service by running below command else skip to step 3.

/etc/init.d/mysqld stop

Step 3:

Check if MySQL service port 3306 is still in use or not by running below command:

netstat -apn | grep 3306

If port is still in use then check the service running on it. If any other service is running on the port 3306 then you will have to either configure MySQL to run on port other than 3306 or stop the service running on port 3306, re-configure its port to some other port number.

Check this post for all the steps to change default port number 3306 on which MySQL service runs.

Step 4:

If MySQL service is found running in step 3 then kill the service using below command:

kill -9 pid

Note: pid is the proceed id you get after running command specified in step 3.

Step 5:

Start the MySQL service using below command:

/etc/init.d/mysqld start

Scenario 2:

Step 1:

Check the bind address in the MySQL configuration file my.cnf generally locate at /etc/my.cnf.

Step 2:

Set the bind address IP as per the requirement (mostly localhost / 127.0.0.1) 

bind-address = 127.0.0.1

You may comment the bind-address field if MySQL service is running on the server itself.

#bind-address = 127.0.0.1

If you are using remote server for MySQl then provide the server IP in the bind-address field.

bind-address = 121.121.134.123

In the above snippet the MySQL is summed to be running on remote server 121.121.134.123

Step 3:

Start the MySQL service

/etc/init.d/mysqld start

Hope this helps!

Photo of Abhijit Sandhan

Love to Automate, Blog, Travel, Hike & spread Knowledge!

В этой статье приведены советы по устранению неполадок, возникающих при использовании Oracle MySQL с Google Workspace Migrate.

Ошибки подключения к сети  |  Отсутствие места на диске  |  Проблемы с паролем  |  Узлы отключены

Ошибки подключения к сети

Специалисты службы поддержки Google Workspace не решают проблемы, связанные с настройкой сети.

Ошибки, в описании которых в журналах хоста сервиса для платформы или узла упоминается сервер MySQL, например ошибки типа Connect Timeout expired (Время ожидания подключения истекло), могут означать, что диск MySQL заполнен или произошла проблема с подключением к сети. Действия по устранению таких ошибок зависят от их периодичности.

Развернуть раздел  |  Свернуть все и перейти к началу

Ошибки возникают время от времени

Такие ошибки могут быть связаны с тем, что диск MySQL заполнен. Выполните следующие действия:

  1. Убедитесь, что соблюдаются системные требования в отношении аппаратного обеспечения сервера MySQL (в частности, достаточно ли ОЗУ, быстродействия ЦП и объема хранилища).
  2. Проверьте, выполняются ли следующие условия для сервера MySQL:
    1. Сервер MySQL установлен с помощью специального установщика от Google.
    2. Запущен только один экземпляр MySQL.
    3. На сервере не установлен антивирус или программа защиты от вредоносного ПО.
    4. Если установлен брандмауэр, то на порте 3306 разрешен входящий трафик.

Инструкции по освобождению места на диске приведены в разделе Что делать, если диск MySQL заполнен ниже.

Ошибки возникают постоянно

Такие ошибки могут свидетельствовать о проблеме с сетью.

  1. Убедитесь в том, что:
    • Сервер MySQL отвечает системным требованиям.

      Они приведены в разделе Требования к оборудованию.

    • Вы установили сервер MySQL с помощью специального установщика от Google.

      Узнайте, как скачать установщики.

    • Вы выполнили все инструкции из статьи Как задать настройки базы данных.
    • Все серверы в кластере Google Workspace Migrate находятся в одной сети без брандмауэров и фильтров между ними.
    • На сервере Windows Server с MySQL не установлено другое программное обеспечение.
    • Вы не меняли стандартные настройки брандмауэра Windows.
  2. Удаленно подключитесь к серверу, который не может подключиться к MySQL, и откройте окно PowerShell как администратор.
  3. Чтобы установить клиент Telnet, введите следующую команду:

    Install-WindowsFeature -name Telnet-Client

  4. Перезагрузите MySQL и сервер, который не может подключиться, и повторите попытку. Если у вас по-прежнему возникают проблемы, перейдите к шагу 6.
  5. Чтобы выполнить тест Telnet, введите следующую команду:

    telnet IP-адрес-сервера-MySQL 3306

  6. Проанализируйте результат теста Telnet. Если:
    • Ошибка не возникает или через несколько секунд появляется сообщение Connection to host lost (Подключение к хосту прервано), то, скорее всего, проблемы с сетью нет. Попробуйте снова воспроизвести ошибку. Для этого откройте платформу Google Workspace Migrate и повторите действие, вызвавшее сбой.
    • Вы можете подключиться через Telnet, но не можете через Google Workspace Migrate (с того же узла или платформы), возможно, исходящие подключения блокирует локальный брандмауэр. Проверьте его настройки на локальном сервере.
    • Возникает ошибка, например Could not open connection to the host, on port 3306: Connect failed (Не удалось подключиться к хосту на порте 3306: сбой подключения), выполните действия в таблице ниже.
Введите команду telnet IP-адрес-сервера-MySQL 3306 на… Результат и действия для устранения
другом сервере узла или платформы

Если команда выполняется на другом сервере без ошибок, то, скорее всего, проблема не в сервере MySQL. Проверьте настройки сети на сервере, где не удалось выполнить команду Telnet.

нескольких серверах

Если возникает ошибка, то это проблема с сетью или сервером MySQL. В таком случае выполните следующие действия:

  1. Подключитесь к серверу MySQL через Удаленный рабочий стол.
  2. В окне PowerShell введите следующую команду, чтобы запустить тест Telnet:

    telnet IP-адрес-сервера-MySQL 3306

  3. Если при попытке ввести команду с сервера MySQL возникает ошибка, выполните инструкции из раздела Что делать, если диск MySQL заполнен.
  4. Если при вводе команды с сервера MySQL ошибка не появляется, то проблема, скорее всего, связана с сетью. Убедитесь, что между серверами нет брандмауэра и что они находятся в одной сети VLAN.
сервере MySQL

Если возникает ошибка, то это проблема с сервером MySQL.

  1. В окне PowerShell подключитесь к локальному хосту с помощью следующей команды:

    telnet localhost 3306

  2. Если не возникнет ошибка, убедитесь, что:
    1. сервер MySQL установлен через установщик от Google;
    2. конфигурация не менялась.
  3. Если возникли ошибки, исправьте их и перезапустите сервер.

Что делать, если диск MySQL заполнен

Признаки того, что диск заполнен:

  • Мост или сегмент не обновляются.
  • Мост выполняется, но объекты не обнаруживаются.
  • В файле HAR появляется сообщение A RelationalDataLocation или Errcode: 28 — No space left on device (Код ошибки 28: на устройстве не осталось места).
  • В журналах хоста сервиса платформы возникают следующие или похожие ошибки:
    • The table ‘bridgeexecutionpartitionmappings’ is full (Таблица bridgeexecutionpartitionmappings заполнена);
    • The table ‘appbridgeidentity’ is full (Таблица appbridgeidentity заполнена).

    Подробнее о том, как проверить журналы хоста сервиса…

Чтобы освободить место на диске, попробуйте сделать следующее:

  • Удалите ненужные мосты или проекты.
  • Увеличьте объем диска с помощью Google Compute Engine, следуя инструкциям в статье о том, как добавить постоянный диск на виртуальную машину.
  • Перенесите данные MySQL на диск большего объема (инструкции можно найти в документации MySQL).
  • Удалите файлы двоичного журнала.

Проблемы с паролем

Развернуть раздел  |  Свернуть все и перейти к началу

Что делать, если срок действия пароля MySQL истек

При входе в платформу может появиться черный экран, а в журналах хоста сервиса отобразится следующая ошибка:

[MySqlException; HRESULT -2147467259] : Your password has expired. To log in you must change it using a client that supports expired passwords. (Срок действия вашего пароля истек. Чтобы войти в систему, измените его с помощью клиента, который поддерживает пароли с истекшим сроком действия.).

Эта ошибка возникает из-за того, что срок действия паролей MySQL по умолчанию истекает примерно через год. Чтобы устранить проблему, выполните следующие действия:

  1. Если у вас нет пароля пользователя root для MySQL, сначала выполните действия из раздела Как сбросить пароль пользователя root для MySQL.
  2. Войдите в аккаунт на компьютере с MySQL и откройте командную строку.
  3. Чтобы подключиться к MySQL, введите следующую команду:

    C:MySQLbinmysql.exe -h 127.0.0.1 -u root -pRootPassword

    Вместо RootPassword введите пароль пользователя root в MySQL. Пробел между -p и паролем ставить не нужно.

  4. Чтобы срок действия пароля не истекал, введите следующую команду:

    ALTER USER USER() IDENTIFIED BY ‘RootPassword‘;
    ALTER USER ‘root’@’127.0.0.1’ PASSWORD EXPIRE NEVER;

    ALTER USER ‘migrate’@’%’ PASSWORD EXPIRE NEVER;
    FLUSH PRIVILEGES;

  5. Перезапустите Google Workspace Migrate на сервере платформы.

Как сбросить пароль пользователя migrate для MySQL

Google Workspace Migrate использует для связи с MySQL пароль пользователя migrate. Чтобы сбросить этот пароль, выполните описанные ниже действия.

Шаг 1. Сбросьте пароль

  1. Если у вас нет пароля пользователя root для MySQL, сначала выполните действия из раздела Как сбросить пароль пользователя root для MySQL.
  2. Войдите в аккаунт на компьютере с MySQL и откройте командную строку.
  3. Чтобы подключиться к MySQL, введите следующую команду:

    C:MySQLbinmysql.exe -h 127.0.0.1 -u root -pRootPassword

    Вместо RootPassword введите пароль пользователя root в MySQL. Пробел между «-p» и паролем ставить не нужно.

  4. Чтобы изменить пароль для пользователя migrate, введите следующую команду:

    ALTER USER ‘migrate’@% IDENTIFIED BY ‘NewUserPassword‘; FLUSH PRIVILEGES;

    Вместо NewUserPassword введите новый пароль пользователя migrate.

Шаг 2. Обновите платформу

Выберите инструкции в зависимости от того, есть ли у вас доступ к платформе.

У меня есть доступ к платформе Google Workspace Migrate:

  1. В верхней части экрана Google Workspace Migrate нажмите Settings (Настройки) ""а затемDatabase settings (Настройки базы данных).
  2. Введите новые пароли для MySQL и Apache CouchDB.

    Необходимо указать оба пароля. Если у вас нет пароля для CouchDB, перейдите к разделу У меня нет доступа к платформе Google Workspace Migrate ниже.

  3. Нажмите Continue (Продолжить).

У меня нет доступа к платформе Google Workspace Migrate:

  1. Войдите в систему на компьютере, на котором используется платформа.
  2. На панели задач нажмите правой кнопкой мыши на значок Google Workspace Migrate "" и выберите Edit host settings (Изменить настройки хоста).
  3. В разделе MySQL settings (Настройки MySQL) нажмите Password (Пароль) и введите новый пароль.
  4. Нажмите Save & Close (Сохранить и закрыть)а затемOK.
  5. На панели задач нажмите правой кнопкой мыши на значок Google Workspace Migrate "" и выберите Stop Google Workspace Migrate service (Остановить сервис Google Workspace Migrate). Затем перезапустите сервис.

Шаг 3. Повторно свяжите узлы

Чтобы применить новые параметры базы данных к узлам, выполните следующие действия:

  1. В верхней части экрана Google Workspace Migrate нажмите Servers (Серверы).
  2. Выберите все узлы и нажмите Delete (Удалить) "".
  3. Добавьте узлы с помощью CSV-файла или вручную.

    Подробнее о добавлении узловых серверов…

Как сбросить пароль пользователя root для MySQL

При выполнении следующих шагов замените NewRootPassword новым паролем пользователя root для MySQL:

  1. Войдите в систему на компьютере с MySQL.
  2. Откройте командную строку в режиме повышенного уровня прав и введите C:MySQLbin.
  3. Чтобы остановить сервис MySQL, введите следующую команду:

    for /f %a in (‘net start ^| find /I «mysql»‘) do @net stop %a

  4. Чтобы подготовить командный файл, который задает новый пароль, введите следующую команду:

    echo|set /p=»UPDATE mysql.user SET authentication_string=password(‘NewRootPassword‘) WHERE user=’root’;» > password-reset-init.txt

  5. Сохраните пароль в безопасном месте.
  6. Чтобы сбросить пароль, введите следующую команду:

    mysqld —defaults-file=»C:MySQLmy.ini» —init-file=»C:MySQLbinpassword-reset-init.txt» —console —skip-grant-tables

  7. Когда журнал прекратит заполняться, нажмите Ctrl + Pause или Ctrl + Break, чтобы завершить выполнение команды.
  8. Чтобы удалить командный файл, введите следующую команду:

    del password-reset-init.txt

  9. Чтобы снова запустить MySQL, введите следующую команду:

    for /f %a in (‘net start ^| find /I «mysql»‘) do @net start %a

Что делать, если узлы отключены и не запускаются

Если у вас истек срок действия пароля MySQL и узлы перестали запускаться, выполните следующие действия:

  1. Войдите в систему на компьютере узла.
  2. Удалите или переименуйте файл C:ProgramDataAppBridgeDataSourceSettings.json.
  3. Чтобы снова установить связь с узловыми серверами:
    1. В правом верхнем углу экрана Google Workspace Migrate нажмите Servers (Серверы).
    2. Выберите все узлы и нажмите Delete (Удалить) "".
    3. Добавьте узлы с помощью CSV-файла или вручную.

      Подробнее о добавлении узловых серверов…

Статьи по теме

  • Устранение неполадок с Google Workspace Migrate
  • Сообщения об ошибках в Google Workspace Migrate 

Google, Google Workspace, а также другие связанные знаки и логотипы являются товарными знаками компании Google LLC. Все другие названия компаний и продуктов являются товарными знаками соответствующих компаний.

In mysql, Can’t connect to MySQL server on localhost error occurs when mysql is unable to connect to localhost due to the connection issue with mysql or a database configuration issue with mysql. You may see an error Can’t connect to MySQL server on ‘127.0.0.1’ when you connect to ip and unable to connect to localhost 3306. You can’t connect to mysql server on localhost or ip 127.0.0.1 (3306) because either the mysql server may not be started or it may not be running, or the network connection to the mysql server is not established, or the mysql server port is different.

Some times, the application can’t connect to local mysql server or mysql could not connect server may not be running or mysql unable to connect to localhost:3306. The application can’t connect to mysql server on ‘localhost:3306’.

If you are trying to access mysql server from a remote server, the error message “Can’t connect to MySQL server on ‘ localhost ‘” may be displayed in the application. This error occurs if the application is unable to connect to mysql server due to a variety of reasons. In this post, we will see the error message “Can’t connect to MySQL server on ‘ localhost ‘” and how to fix this error.

The error message indicates that there is a problem when connecting to mysql from the calling application. If you identify a connectivity issue, the error message will be fixed.

Can't connect to MySQL server on 'localhost'
Can't connect to local MySQL server through socket '/tmp/mysql.sock'

Root Cause

The error is shown in the application because the application was unable to connect to the mysql server. There could be a number of reasons. This issue is caused by a network failure.

The network failure could be on mysql server side or on the connecting application side. The other reason is that the mysql server is not running on the server. Mysql may be shut down manually, or mysql may not be running on the server machine due to some error.

Solution 1

If the database is running on the local machine, run the ping command with localhost. If the database is running on the remote server, ping the ip of the database server. In this way, we can validate the database server is alive or shutdown or network issue. If the ping does not respond, check that the server is switched on. Check that the network cable is connected correctly.

For local machine

$> ping 127.0.0.1

For remote server

$> ping <ip of the remote server>

$> ping 172.168.1.3

Solution 2

Check that mysql is running or not in the database server. The mysql server may be switched off or stopped due to some critical error. try to restart the mysql server. Check the following command to check whether the mysql server is running or not.

$> netstat -ln | grep mysql

fcc1dd9a70716e73 stream      0      0 fcc1dd9a734eb92b                0                0                0 /tmp/mysqlx.sock
fcc1dd9a707174b3 stream      0      0 fcc1dd9a732f1f7b                0                0                0 /tmp/mysql.sock

The command above shows the network status of the mysql command. The command below will show whether or not the mysql port is listening. The default port number is 3306.

$> netstat -ln | grep 3306

tcp4       0      0  127.0.0.1.3306         127.0.0.1.53815        ESTABLISHED
tcp4       0      0  127.0.0.1.53815        127.0.0.1.3306         ESTABLISHED
tcp4       0      0  127.0.0.1.3306         127.0.0.1.53814        ESTABLISHED
tcp4       0      0  127.0.0.1.53814        127.0.0.1.3306         ESTABLISHED

If the above two commands do not return the expected result, check whether the mysql process is running or not using the following command.

$> ps -ax | grep mysql
  113 ??         4:47.15 /usr/local/mysql/bin/mysqld --user=_mysql --basedir=/usr/local/mysql  ... ... ... ... ... ... ... ... --early-plugin-load=keyring_file=keyring_file.so

Solution 3

If mysql is running, check the status of mysql service. If the server appears to be running. Stop the server and restart the service again. If mysql server is hung due to issues such as memory issues, the network issue will be resolved. Use the command below to check the service

$> sudo server mysql status

$> sudo server mysql stop

$> sudo server mysql start
$> sudo /etc/init.d/mysqld status

$> sudo /etc/init.d/mysqld stop

$> sudo /etc/init.d/mysqld start

Solution 4

The mysql server is running without error. Network issues have been resolved and no network issues have been identified. Now connect to mysql server using mysql command. You can also check using the telnet command

$> telnet 172.168.1.3 3306
$> mysql -u root -p -h <host name/ip>

if the port is different from the default port 3306

$> mysql -u root -p -h <host name/ip> -P <port>

Solution 5

If the above command is working successfully and you still see error in mysql. Check out my.cnf file. My.cnf file contains all configurations of mysql. Run the command below to find the location of my.cnf file,

$> mysql --help | grep my.cnf

or just run 

$> mysql --help

Open my.cnf file and search for the word bind-address. If there is an existing change as below. If it doesn’t exist, add the line below.

to refer the localhost 
bind-address = 127.0.0.1

to refer for any address
bind-address = 0.0.0.0

Solution 6

If all of the above steps are checked and configured, restart the mysql server. All changes will be updated and start with a new configuration. If there is an error in the configuration, mysql will throw an error and will not start the server. Run the command below to check and restart mysql server

$> sudo server mysql status

$> sudo server mysql stop

$> sudo server mysql start

Solution 7

Start the mysql server with install and initialize option and check the mysql server is running or not. if you are using windows, run the mysql server as admin.

C:Program FilesMySQLMySQL Serverbin>mysqld --install

C:Program FilesMySQLMySQL Serverbin>mysqld --initialize

Solution 8

If you are using windows operating system and mysql database is installed newly, then use “MySQL Installer – Community” from the menu to reconfigure. select “mysql server” in the product tab and click the “reconfigure” in the “Quick Action” tab. This will reconfigure the mysql database.

Contents

  1. Server Not Running in Specified Location
  2. Unable to Connect from a Remote Location
  3. Authentication Problems
    1. Problems Exporting Query Results
    2. Access to the Server, but not to a Database
    3. Option Files and Environment Variables
    4. Unable to Connect to a Running Server / Lost root Password
    5. localhost and %
  4. See Also

If you are completely new to MariaDB and relational databases, you may want to start with the MariaDB Primer. Also, make sure you understand the connection parameters discussed in the Connecting to MariaDB article.

There are a number of common problems that can occur when connecting to MariaDB.

Server Not Running in Specified Location

If the error you get is something like:

mysql -uname -p
ERROR 2002 (HY000): Can't connect to local MySQL server through 
  socket '/var/run/mysqld/mysqld.sock' (2 "No such file or directory")

or

mysql -uname -p --port=3307 --protocol=tcp
ERROR 2003 (HY000): Can't connect to MySQL server on  'localhost' 
  (111 "Connection refused")

the server is either not running, or not running on the specified port, socket or pipe. Make sure you are using the correct host, port, pipe, socket and protocol options, or alternatively, see Getting, Installing and Upgrading MariaDB, Starting and Stopping MariaDB or Troubleshooting Installation Issues.

The socket file can be in a non-standard path. In this case, the socket option is probably written in the my.cnf file. Check that its value is identical in the [mysqld] and [client] sections; if not, the client will look for a socket in a wrong place.

If unsure where the Unix socket file is running, it’s possible to find this out, for example:

netstat -ln | grep mysqld
unix  2      [ ACC ]     STREAM     LISTENING     33209505 /var/run/mysqld/mysqld.sock

Unable to Connect from a Remote Location

Usually, the MariaDB server does not by default accept connections from a remote client or connecting with tcp and a hostname and has to be configured to permit these.

(/my/maria-10.4) ./client/mysql --host=myhost --protocol=tcp --port=3306 test
ERROR 2002 (HY000): Can't connect to MySQL server on 'myhost' (115)
(/my/maria-10.4) telnet myhost 3306
Trying 192.168.0.11...
telnet: connect to address 192.168.0.11: Connection refused
(/my/maria-10.4) perror 115
OS error code 115:  Operation now in progress

To solve this, see Configuring MariaDB for Remote Client Access

Authentication Problems

Note that from MariaDB 10.4.3, the unix_socket authentication plugin is enabled by default on Unix-like systems. This uses operating system credentials when connecting to MariaDB via the local Unix socket file. See unix_socket authentication plugin for instructions on connecting and on switching to password-based authentication as well as Authentication from MariaDB 10.4 for an overview of the MariaDB 10.4 changes..

Authentication is granted to a particular username/host combination. user1'@'localhost', for example, is not the same as user1'@'166.78.144.191'. See the GRANT article for details on granting permissions.

Passwords are hashed with PASSWORD function. If you have set a password with the SET PASSWORD statement, the PASSWORD function must be used at the same time. For example, SET PASSWORD FOR 'bob'@'%.loc.gov' = PASSWORD('newpass') rather than just SET PASSWORD FOR 'bob'@'%.loc.gov' = 'newpass';

Problems Exporting Query Results

If you can run regular queries, but get an authentication error when running the SELECT … INTO OUTFILE, SELECT … INTO DUMPFILE or LOAD DATA INFILE statements, you do not have permission to write files to the server. This requires the FILE privilege. See the GRANT article.

Access to the Server, but not to a Database

If you can connect to the server, but not to a database, for example:

USE test;
ERROR 1044 (42000): Access denied for user 'ian'@'localhost' to database 'test'

or can connect to a particular database, but not another, for example
mysql -u name db1 works but not mysql -u name db2, you have not been granted permission for the particular database. See the GRANT article.

Option Files and Environment Variables

It’s possible that option files or environment variables may be providing incorrect connection parameters. Check the values provided in any option files read by the client you are using (see mysqld Configuration Files and Groups and the documentation for the particular client you’re using — see Clients and Utilities).

Option files can usually be suppressed with no-defaults option, for example:

mysqlimport --no-defaults ...

Unable to Connect to a Running Server / Lost root Password

If you are unable to connect to a server, for example because you have lost the root password, you can start the server without using the privilege tables by running the --skip-grant-tables option, which gives users full access to all tables. You can then run FLUSH PRIVILEGES to resume using the grant tables, followed by SET PASSWORD to change the password for an account.

localhost and %

You may have created a user with something like:

CREATE USER melisa identified by 'password';

This creates a user with the ‘%’ wildcard host.

select user,host from mysql.user where user='melisa';
+--------+------+
| user   | host |
+--------+------+
| melisa | %    |
+--------+------+

However, you may still be failing to login from localhost. Some setups create anonymous users, including localhost. So the following records exist in the user table:

select user,host from mysql.user where user='melisa' or user='';
+--------+-----------+
| user   | host      |
+--------+-----------+
| melisa | %         |
|        | localhost |
+--------+-----------+

Since you are connecting from localhost, the anonymous credentials, rather than those for the ‘melisa’ user, are used. The solution is either to add a new user specific to localhost, or to remove the anonymous localhost user.

See Also

  • CREATE USER
  • GRANT
  • Authentication from MariaDB 10.4
  • Authentication from MariaDB 10 4 video tutorial

Понравилась статья? Поделить с друзьями:
  • Mysql 2014 error
  • Mysql 1366 ошибка
  • Myrtille error 1001
  • Mypy ignore error
  • Myphoneexplorer obex errorcode d0 internal server error