MySQL: Access denied for user to database - mysql

I'm trying to create a database on my remote sql server - clearDB - on Heroku. I connected with this:
mysql --host='<<cleardbhostname>>' --user='<<lsdj234>> --password
My username and password are obtained from the result from running heroku config. When I tried to run
CREATE DATABASE mydb;
I got this:
ERROR 1044 (42000): Access denied for user '<<lsdj234>>'#'%' to database 'mydb'
When I ran SHOW GRANTS for current_user I got:
GRANT USAGE ON *.* TO '<<lsdj234>>'#'%' IDENTIFIED BY PASSWORD '*asfe4545235' WITH MAX_QUERIES_PER_HOUR 3600 MAX_USER_CONNECTIONS 10 |
| GRANT ALL PRIVILEGES ON `heroku_ljl4455lkj`.* TO '<<lsdj234>>'#'%'
What is happening? How do I resolve this?

The only database that your user can access (and even create) is heroku_ljl4455lkj
It can't create any other databases.

Related

How to grant root user in mysql database user table all privileges

I accidentally removed all privileges for root user in mysql database user table.
By helping best at MySQL Error: : 'Access denied for user 'root'#'localhost' I can now access database but I cannot grant all privileges to my root user at localhost.
Via PHPMyAdmin interface when I go and try to add, I get this error:
#1290 - The MariaDB server is running with the --skip-grant-tables option so it cannot execute this statement
But I cannot access database and phpmyadmin without skip-grant-tables option.
This is the query runs but returns error:
GRANT ALL PRIVILEGES ON *.* TO 'root'#'localhost' REQUIRE NONE WITH GRANT OPTION MAX_QUERIES_PER_HOUR 2147483647 MAX_CONNECTIONS_PER_HOUR 2147483647 MAX_UPDATES_PER_HOUR 2147483647 MAX_USER_CONNECTIONS 2147483647;
What should I do?

Access denied for user 'user1'#'localhost' goddady

does anybody know in which table godaddy store the users table ?
I have a database created using database wizard and I have added a user using the mysql database wizard to the database. But I still get the error;
Connection failed: Access denied for user 'user1'#'localhost' (using password: YES)
I tried this:
GRANT ALL PRIVILEGES ON *.* TO 'user1'#'%'; FLUSH PRIVILEGES;
But I keep getting;
1045 - Access denied for user 'cpses_odldzcvpqv'#'localhost' (using password: YES)
It must have something to do with the USER_PRIVILEGES table in information_shema. when I type
SELECT * FROM `USER_PRIVILEGES`
IS_GRANTABLE is set to NO.
On unix based systems, mysql treats localhost and tcp/ip separately. If you wish to give access to localhost, you must also give an explicit permission to localhost along with %.
GRANT ALL PRIVILEGES ON *.* TO 'user1'#'localhost' identified by '<password>';
or you can connect via 127.0.0.1 instead of localhost. That'll work.
mysql -u user1 -p<password> --host 127.0.0.1

Mysql: new user access denied to database

I'm using Mysql 5.5. I logged in mysql by root and created a new user.
Then I logged in using
mysql -u newuser -p
Then in mysql I entered
GRANT ALL PRIVILEGES ON db1.tablename TO 'newuser'#'localhost';
in order to access to the databases.
But there is an error message:
ERROR 1142 (42000): SELECT,INSERT,UP command denied to user 'newuser'#'localhost' for table 'tablename'
I even tried other commands such as GRANT CREATE or GRANT DROP, the same error keep showing.
ERROR 1142 (42000): CREATE,GRANT command denied to user 'newuser'#'localhost' for table 'tablename'
Can someone please help?
You logged into MySQL as root and created the new user, but you need to grant the permissions to the new user as well while logged in as root. Then you'll be able to login as newuser and execute statements.

1044 - Access denied for user 'root'#'%' to database 'test' cleardb

I have an issue that when i try to connect to a database in cleardb it gives me this error:
1044 - Access denied for user 'root'#'%' to database 'test'
when it connect via navicat and try to upload new test.sql file to update my database i get the same error.
is there a way to do it?
Default root user in MySQL does not have permissions to access outside local host, so you should create a user to be able to do this like:
CREATE USER 'someuser'#'%' IDENTIFIED BY "your_password";
GRANT ALL PRIVILEDGES ON test.* TO 'someuser'#'%';
Then try connecting with this user

How to change/alter the mysql database user

I have the mysql database user on server as rob and password something like rob123
And now i tried to create a database for user rob, so i logged in as
mysql -u rob -prob123
I can able to login successfully and when tried to create a database like below
create database hello;
i got below error
ERROR 1044 (42000): Access denied for user 'rob'#'%' to database 'hello'
So i logged in as default mysql user as root and logged in successfully
mysql -u root
Now i can able to create a database with create database hello; , but i need to change the user of this database 'hello' as rob and password as rob123.
So how to alter the user of the database ?
you need to create user and grant permissions:
use hello;
create user rob identified by 'rob';
grant all on rob.* to 'rob'#'%';
grant select on `mysql`.`proc` to 'rob'#'%';