Get the App
SLTechnology News&Howtos  ›  Servers  › 

Mysql error ERROR 1044 (42000): Access denied for user

Shulou Source: shulou.com Published: 2022-06-03 07:49:45 09月21日 Update

Mysql error ERROR 1044 (42000): Access denied for user'@ 'localhost' to database' MAC' solution

MariaDB [(none)] > create database MAC;ERROR 1044 (42000): Access denied for user'@ 'localhost' to database' MAC'MariaDB [(none)] > method 1: 1. Close mysql # service mysqld stop [Note centos7 is systemctl stop mariadb] 2. Block permission # mysqld_safe-- the skip-grant-table screen appears: Starting demo from. 3. Enter # mysql-uroot-pxxxxxx MariaDB [(none)] > use mysql; MariaDB [mysql] > MariaDB [mysql] > UPDATE user SET Password=PASSWORD ('newpassword') where USER='root'; [Note: next time you will log in to the database with newpassword password] MariaDB [mysql] > FLUSH PRIVILEGES / / remember to ask for this sentence, otherwise if you close the previous terminal There will be the original error MariaDB [mysql] >\ Q Murray-my hands-on test [root@nessus] # systemctl stop mysqldFailed to stop mysqld.service: Unit mysqld.service Not loaded. [root@nessus ~] # systemctl stop mariadb [root@nessus ~] # [root@nessus ~] # [root@nessus ~] # mysqld_safe-- skip-grant-table191030 11:11:24 mysqld_safe Logging to'/ var/log/mariadb/mariadb.log'.191030 11:11:24 mysqld_safe Starting mysqld daemon with databases from / var/lib/mysql opens a new terminal enter [root@nessus ~] # mysql-uroot [my no password] MariaDB [(none)] > use mysql Reading table information for completion of table and column namesYou can turn off this feature to get a quicker startup with-ADatabase changedMariaDB [mysql] > UPDATE user SET Password=PASSWORD ('newpassword') where USER='root';Query OK, 4 rows affected (0.01sec) Rows matched: 4 Changed: 4 Warnings: 0MariaDB [mysql] > MariaDB [mysql] > MariaDB [mysql] > FLUSH PRIVILEGES Query OK, 0 rows affected (0.00 sec) MariaDB [mysql] >\ qBye [root@nessus ~] # mysql-uroot [found to be unable to log in without a password] ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO) [root@nessus ~] # [root@nessus ~] # mysql-uroot-pnewpassword [login database with newpassword password] Welcome to the MariaDB monitor. Commands end with; or\ g.Your MariaDB connection id is 5Server version: 5.5.60-MariaDB MariaDB ServerCopyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.Type 'help;' or'\ h' for help. Type'c'to clear the current input statement.MariaDB [(none)] > create database MAC;Query OK, 1 row affected (0.00 sec) MariaDB [(none)] > MariaDB [(none)] >

Tags: Password terminal error remarks data database new login input method screen method permission this sentence test login Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno OPPO Reno Xiaomi Linux Docker Redmi