Access denied for user error during install phpmyadmin - mysql

I want to install phpmyadmin on Ubuntu 20.04. I take the password 2 times (first I tryed root password but after I tryed leave the field empty or use other password). Any time I error like screen of my error. I found this tutorial.
Author of this article wrote:
From the prompt, run the following command to disable the Validate
Password component. Note that this won’t actually uninstall it, but
just stop the component from being loaded on your MySQL server:
But this component is disable and yet I still have this error. How can I solve my problem

The error message you posted is different from the Validate Password one in the tutorial. I suggest re-enabling the option that you disabled.
Your error is showing that you (or someone) has changed the password of the MySQL user that Ubuntu (and Debian) uses for administrative purposes (debian-sys-maint). Details of that user are documented in README.Debian and the password is stored on disk in /etc/mysql/debian.cnf.
To resolve this, you can simply set the password to a known value and edit the configuration file to tell your system the new password.
Presumably, you're using MySQL 8.0.20, in which case you would connect through the command line client (mysql -u root -p) and run a command like this: ALTER USER 'debian-sys-maint'#'localhost' IDENTIFIED BY 'aReallyComplexPassword';.
On the chance that you're using MariaDB, the command is SET PASSWORD FOR 'root'#'localhost' = PASSWORD('aReallyComplexPassword');.
You won't need the password again after you put it in /etc/mysql/debian.cnf). Note that you'll need to edit the debian.cnf file as root or sudo.

Related

Unable to connect to MySQL instance after installing

I'm setting up a MySQL database following this tutorial. I installed it and successfully initialized an instance with a root password, but I am having trouble connecting to the instance via command line. When I click on the 'mysql' executable under bin, I get this message
ERROR 1045 (28000): Access denied for user 'hunter'#'localhost' (using password: NO)
and if I try to enter
> mysql -u root -p
in the terminal I get this message
-bash: mysql: Permission denied
It says in the instructions that I should be getting prompted to enter the password for the database, but for some reason it won't let me.
I would suggest first off to try a mysql workbench. You can download it at https://dev.mysql.com/downloads/workbench/ .
It seems that calling mysql from bash is causing issues for you. If you are using a *Nix environment, it could be a permissions issue and you need to set the correct permissions on the mysql binary. However, usually a correct installation should have already done that. See: https://askubuntu.com/questions/229589/how-to-make-a-file-e-g-a-sh-script-executable-so-it-can-be-run-from-a-termi
Secondly, you should use the username root . hunter is not default username.
From the mysql documentation:
How to Reset the Root Password
If you have never assigned a root password for MySQL, the server does not require a password at all for connecting as root. However, this is insecure. For instructions on assigning a password, see Section 2.10.4, “Securing the Initial MySQL Account”.
Reference:
https://dev.mysql.com/doc/refman/8.0/en/resetting-permissions.html

Can't connect to MySQL using SequelPro

I have recently installed MySQL 5.7.16 on an iMac running El Capitan. I had a few minor hiccups initially because I forgot the root password but that has now been reset and I can now log into MySQL as root user using:
$ mysql -u root -p
However, when I try to connect to MySQL server as root using SequelPro, I get the message:
Unable to connect via the socket, or the request timed out.
Double-check that the socket path is correct and that you have the necessary privileges, and that the server is running.
MySQL said: Your password has expired. To log in you must change it using a client that supports expired passwords.
When I look in /tmp folder, I was expecting to find mysql.sock but, instead, there is a file called mysql.sock.lock. Could this be causing the problem? I can't find where that .lock file has come from and I'm not sure what to do about it. Any help would be appreciated.
I'm not entirely sure what happened to cause the root password to expire but something had thrown a spanner in the works. Anyway, the solution for me was to log into MySQL from the Terminal using:
$ mysql -u root -p
...and then alter the root user's password using:
> ALTER USER 'root'#'localhost' IDENTIFIED BY 'NewPass';
That seemed to do the trick. I was then able to log in to MySQL using Sequel Pro with no problems.
Instead of using a socket connection, you could try connecting via Sequel Pro's standard connection using 127.0.0.1 as the host.
Thus spake the 5.7 docs:
The installation process creates only a single root account, 'root'#'localhost', automatically generates a random password for this account, and marks the password expired. The MySQL administrator must connect as root using the random password and assign a new password. (The server writes the random password to the error log.)
So, connect from terminal and change the root password.
Either your first password may not have been saved OR it just truly never persisted.
For me it was the sudo /usr/local/bin/mysql_secure_installation that may not have ever persisted the password correctly. Since your first password never changed, there is no password or ,like your error said, "expired" to nothing.
Run or rerun the code above, don't type anything for the password field and follow the steps, from the preloaded setup program.

MySQLInstallerConsole not setting root password?

I am installing MySQL on Windows with the following command line:
MySQLInstallerConsole community install -silent server;5.7.12;x64:*:type=config;servertype=Server;openfirewall=true;generallog=true;serverid=3306;enable_tcpip=true;port=3306;rootpasswd=%1;installdir="C:\MySQL\MySQLServer-5.7":type=user;username=foo;password=bar;role=DBManager
This line is contained in a script, and I pass in the root password from a random generated string. However, I am getting an access denied for 'root'#'localhost' when trying to access the server via
mysql -u root -p
(and providing the password)
I can not find any issues with the parameters for MySQLInstallerConsole. Connecting as user foo even works, but I really need the root password to work.
Any ideas?
I finally figured out what the issue was: the system had a MySQL server installed before. The service and binaries had all been removed, but there still was a MySQL data directory in the default location (somewhere in %ProgramData%"). This seems to cause to make the installer console fail to finish the new installation WITH a different root password.
Removing the old data directory and re-running the installer command line as stated in the original question (without any changes) resulted in successful installation.

Can't log into or get Mysql cmd line

I have a VPS running CentOS and have apache, php, mysql all installed. I was following a tutorial for installation and apparently did something wrong when setting up mysql (I believe something with setting user and password). Now whenever I try to get to the MySQL command line interface I receive this error.
ERROR 1045 (28000): Access denied for user 'root'#'localhost' (using password: YES)
I looked this up and got a few suggestions to try to bypass so I can reset the passwords. I've tried:
/etc/init.d/mysqld --skip-grant-tables
Which came up with the same error. I tried reinstalling by first removing mysql and then installing it again. Same Error appears. What else can I do?
(if U don't have anything in DB, remove mysqlDB - not installation, but DB files in /var/lib/mysql/ - backup it first!)
start this: shell# mysql_secure_installation
it will ask U to:
Set a root password. If you already have it
you’ll need to enter it for the remaining steps.
Remove anonymous users
Disable non-local root access
Remove the test database and access rules related to it
Reload privilege tables so the above changes are in effect
BR

Phpmyadmin - Mysql no privileges

I installed wamp 2.1 on windows 7. However when i open phpMyAdmin, I get the error, Mysql 'No Provileges'. I uninstalled wamp and reinstalled it a few times, but it doesn't help. Does anyone know how to solve this issue?
Also, when i tried creating a database from mysql console, i am getting the following error:
ERROR 1044 <42000>: Access denied for user ''#'localhost' to database 'a_db_name'
Thank God and to all helped.
Its simple.
Must! click logout icon in phpadmin page
In login page, type:
username:root password: (blank)
surprise. now you can happily create your database.
Are you logging into MySQL as root? You have to explicitly grant privileges to your "regular" MySQL user account while logged in as MySQL root.
First set up a root account for your MySQL database.
In the terminal type:
mysqladmin -u root password 'password'
To log into MySQL, use this:
mysql -u root -p
Edit:
To set the privileges manually start the server with the skip-grant-tables option, open mysql client and manually update the mysql.user table and/or the mysql.db tables. This can be a tedious task though so if what you need is an account with all privs I would do the following.
Start the server with the skip-grant-tables option
Start mysql client (without a username/password)
Issue the command
flush privileges;
which forces the grant tables to be loaded.
Create a new account with the GRANT command something like this (but replacing username and password with whatever you want to use.
GRANT ALL on *.* to 'username'#'localhost' identified by 'password';
Restart the server in normal mode (without skip-grant-tables) and log in with your newly created account.
Refer this MySQL docs.
Take a look at my topic regarding this issue, which takes some of the above.
MAMP mysql broken root user
You need to shutdown your mysql install and restart it from the command line properly like is indicated above. In my topic I have full clear instructions on how to do so. My instructions are for MAMP but you should be able to adapt it for your install.
Simple solution. Just find the icon right to "home" in PhpMyAdmin and click to logout. Then login using username "root" and password ""(blank). This will work accordingly.
username ought to be root and keep the password null(keep the password field blank)
right click on the wamp icon and goto mysql console.
Login with password if you have set any.By default the password is blank and username is 'root'
Once you are in mysql prompt execute
FLUSH PRIVILEGES;
now quit the command prompt and you are good to go.
in step 1 .inter your databasevery important.
in step 2 .select your database via all tables .
in step 3. backup type=replace & export.
in step 4 import database in my sql.
attention please:in import your database...
all table must view & selected in step 4.