Mysql "access denied for user" error? - mysql

I have just added a new database and imported alot of backed up data to it because of a malfunction in the previous database.
I use php and have my own Ubuntu server.
I use phpmyadmin, and have set all privileges to the user.
I am positive the password, username and host are correct.
But I still get this "Access denied for user 'user'#'localhost' to database 'skuffen2'"
What should I do?
Do I need to set permissions somehow on the server?
Please guide me I am in deep need of help right now...
Thanks

login to mysql using root user, use mysql; select * from db where user where user_name=xxx; and check other table as well, most of the privileges settings are there, or just simply flush privileges;

Related

MySQL Access Denied For User on Other Laptop

I have created a database using MySQL version 8.0.22 (I realize it's not the newest version but the newer version didn't work on my laptop). I need to have somebody (for who I made the database for) have full access to the database from their own laptop. I created their user with a password, granted full access, and flushed privileges.
CREATE USER 'user'#'localhost' IDENTIFIED BY 'password1234!';
GRANT ALL PRIVILEGES ON fsk TO 'user'#'localhost' WITH GRANT OPTION;
FLUSH PRIVILEGES;
However, I still got the error:
"Access denied for user 'user#'localhost' (using password: YES)"
I have been googling this error for the past two days and have everything from making sure there aren't any duplicates that contain "%" instead of "localhost" to reinstalling the program. For even more clarification, when trying to connect on MySQL Workbench, I entered 'localhost' for the "Hostname" field (didn't use quotes around localhost), the correct username, and finally, the correct password (made sure after attempting plenty of times very slowly).
Am I missing something with trying to get this working? I really just need one user to have full access to the database from another laptop and I keep getting "Access Denied" when trying to log in as that user I have created.
Any help would be GREATLY appreciated.

#1044 - Access denied for user 'someusr'#'localhost' to database 'somedb'

I'm trying to give admin rights to MySQL user using this SQL statement ran on cpanel>phpmyadmin>SQL
GRANT ALL PRIVILEGES ON somedb.* TO 'someusr'#'localhost' IDENTIFIED BY 'password' WITH GRANT OPTION;
but it's giving user denied error:
#1044 - Access denied for user 'someusr'#'localhost' to database 'somedb'
We are trying to Integrate our website "www.somewebsite.com" MySQL database with Peachtree accounting software using Dell Boomi AtomSphere.
As per Dell Boomi forums. They replied in the link.
https://community.boomi.com/message/8983
There is no global privileges option on the phpMyAdmin page. There is only data and structure privileges in Cpanel>MySQL Database but no Administration privileges as shown in this video # 8:27 sec;
https://youtu.be/64nYbTkcRZ4?t=507
I tried using SHOW GRANTS FOR 'someusr'#'localhost';
It's showing:
Grants for someusr#localhost
GRANT USAGE ON . TO 'someusr'#'localhost'
IS GRANTABLE = NO
What should I do?
Actually there are two steps to solve this problem if you are using Cpanel.
First step is to go to Remote MySQL and add your IP address of your network.You can check your IP by going to whatismyipaddress.com or add % percent sign so that anyone can access it but this is not recommended because of security issues.
Secondly go to the MySQL Database and grant all user privileges like select, update, delete etc. Now you cannot get any user denied error using dell boomi.
This should work (assuming the database is already there):
CREATE USER 'someusr'#'localhost' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON somedb.* TO 'someusr'#'localhost';
FLUSH PRIVILEGES;
A bit late to the party ( again) but here is another simple solution that wworked for me in the same case :
Open the *.sql file in a text editor and change all instances of old_db_name' tonew_cpanel_db_name'. and try to import again.
Most likely there will be only few occurences at the top of the file, something like :
`
--
-- Database: `old_db_name`
--
CREATE DATABASE IF NOT EXISTS `old_db_name` DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci;
USE `old_db_name`;
`
worked for me severaal times..

Access denied creating initial database- how do I grant the right access?

I'm making a new project on heroku, using mysql (they have an addon called JawsDB, which gives me a mysql host, username, password). (Update: I've also tried using their other mysql addon, ClearDB, and I have the exact same issue)
I can connect to the database like so (and I can 'show databases' to see what's there):
mysql -h izm96dhhnwr2ieg0.cbetxkdyhwsb.us-east-1.rds.amazonaws.com -u knu81lzn5m79u3rx -p[given_password]
Problem: When I do create database nptest, I get:
Access denied for user 'knu81lzn5m79u3rx'#%' to database 'nptest'
I've tried granting all privileges, like this:
grant all privileges on *.* to 'knu81lzn5m79u3rx'#'%' identified by '[given_password]';
but that gives me:
Access denied for user 'knu81lzn5m79u3rx'#'%' (using password: YES)
I also tried create user to make a fresh one, but of course then it's "Access denied" because I don't have create user privileges either.
What's the correct way to grant access to this user?
Ah! The answer was that the preliminary plan on jawsDB gives you one specific database (that has a cryptic name) on a shared server with other people, so you don't have permissions to make a new one. It wasn't clear in the instructions, so now I'm humming away with good old database "tbkrv66g085ulngi" :)
To further clarify on Diane's answer, the cryptic database name can be found by logging into JawsDB via a mysql client and runningshow databases or it's the last parameter of the JAWSDB_URL that can be found running heroku config.
i think if you use it in production mode it will solve the probl

1044 - Access denied for user 'user'#'localhost' to database 'db'

I tried a lot to import the sql script to create database and tables through phpmyadmin in the new site I hosted. But i'm getting the error,
1044 - Access denied for user 'user'#'localhost' to database 'db'
I tried to create a sample db directly : create database sampled; I'm getting the same access denied error.
I'm not able to grant privileges to the user also, i'm getting the same access denied error.
Following is the output of show grants command,
show grants;
GRANT USAGE ON . TO 'someuser'#'localhost' IDENTIFIED BY PASSWORD 'somepw'
GRANT ALL PRIVILEGES ON someuser\_%.* TO 'someuser'#'localhost'
Any help would be appreciated. thank you.
If you are using Godaddy then don't directly go to phpMyAdmin and run the sql command.
You have to go to MySQL® Databases section and create a database there.
Then create a user and give it the permission to access the database you just created.
Now you can go to phpMyAdmin and write your SQL commands.
Hope this helps
It is clear that the user someuser do not have proper privilege over the database db. You need to grant privileges for the user over the database to correct this issue.
If you do bot have administrative rights contact your admin for granting privileges to someuser on that db
For me the problem is I'm not having permissions to Create new Databasename or even Modify the name of the Database. You can contact your admin to avail privileges or if you want to quickly import the .sql file... then you can open the .sql file with text editor and find the following line:
CREATE DATABASE IF NOT EXISTS `enter the existing db name` DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci;
USE `enter the existing db name`;
After that try to import the .sql file...now you can successfully import all the tables!
This error can be avoided in the beginning when creating the user account. Following commands must be used to create user account having all the PRIVILEDGES.
CREATE USER 'demouser'#'localhost' IDENTIFIED WITH mysql_native_password BY '***';
GRANT ALL PRIVILEGES ON *.* TO 'demouser'#'localhost' WITH GRANT OPTION;
ALTER USER 'demouser'#'localhost' REQUIRE NONE WITH MAX_QUERIES_PER_HOUR 0 MAX_CONNECTIONS_PER_HOUR 0 MAX_UPDATES_PER_HOUR 0 MAX_USER_CONNECTIONS 0;
CREATE DATABASE IF NOT EXISTS 'demouser';
GRANT ALL PRIVILEGES ON `demouser`.* TO 'demouser'#'localhost';
Must Ensure that your User_Name, Password and Database name are correct.
If you are Deal with database 'sampled' then type 'sampled' in query instead of 'db' also must ensure that you don't have to use quota(') in Statement.
you have not exported database from localhost or from web server correctly follow these steps go to localhost database click export tab than select 'Custom - display all possible options 'check box few options will open in section 'output' change compression none to zipped and now click go button at bottom it will properly export your database you can now import to hosting or anywhere you want with no errors
I had the same problem i solve it buy change the GRANTEE and made the user he can do all the operation in PhpMyAdmin ,follow the steps :
Enter to mysql in root permission but :
sudo mysql
Enter the password, and type this :
SELECT * FROM information_schema.user_privileges;
And see the user in IS_GRANTABLE is he yes or no.
If he yes then see the PRIVILEGE_TYPE what it might it be just tow operation if it's true add the last operations.
and see this link to change IS_GRANTABLE from no to yes.
I wish this could help you.
I started getting this error message for no reason at all. Solved by using MySQL and the Server menu option; Selected my bitnami_wordpress schema; selected the bn_wordpress user; then picked the Administrative Roles tab and granted access to this user. I had to do this to all of the users that the access was removed from.

How do I manually block and then unblock a specific IP/Hostname in MYSQL

First off, I did google this but sites are flooded with advice on how to deal with "host name is blocked" issues. (https://www.google.com/search?q=mysql+block+a+host). My issue is a little bit the opposite of that.
With me, I am running a MySQL database and no PHP is involved.
I need to block a certain host-name/IP address from connecting to my database, then I will unblock it. I am hoping there are 2 simple queries for this that I can execute on the MySQL database, I just can't seem to find it anywhere.
I can find the hostnames pretty easily by running the show processlist query and I know I can kill one process at a time, but so many new threads pop up that if I can just block all of them from a certain hostname, that would be ideal. Then I will unblock once I fix a few things.
You can use GRANT to give a non-privileged entry for a user connecting from a specific host, even if you have GRANTed privileges to a wildcard including that host. When authenticating, the most specific host match takes precedence.
For example, suppose you enabled a user to connect from a range of hosts on your local subnet:
mysql> GRANT ALL PRIVILEGES ON *.* TO 'user'#'192.168.56.%' IDENTIFIED BY 'xyzzy';
Then you could grant the minimal USAGE privilege, which is a synonym for "no privileges" for that user for one specific host within that subnet:
mysql> GRANT USAGE ON *.* TO 'user'#'192.168.56.110';
Subsequent attempts to connect from that host get this error:
$ mysql -uuser -pxyzzy
ERROR 1045 (28000): Access denied for user 'user'#'192.168.56.110' (using password: YES)
The reason this gets an error is that I did this grant for the user with no password. If I try to submit a password, this doesn't match the entry in the privileges table.
Even if the user tries to connect without using a password, he finds he has no access to anything.
$ mysql -uuser
mysql> USE mydatabase;
ERROR 1044 (42000): Access denied for user 'user'#'192.168.56.110' to database 'mydatabase'
You can undo the blocking:
mysql> DELETE FROM mysql.user WHERE host='192.168.56.110' AND user='user';
mysql> FLUSH PRIVILEGES;
And then the IP range will come back into effect, and the user will be able to connect from thathost again.
You can revoke privileges as mentioned above, but this will still allow a user to make a connection to your MySQL server - albeit this will prevent that user from authenticating. If you really want to block/allow connections to your MySQL server based on IP, use iptables.
Have you tried using MySQL Workbench?
You can simply remove ROLES for a specific User/Host from there.