I have tried to create database on server by CREATE DATABASE cpi_mock but getting an error like #1044 - Access denied for user 'cpibetap'#'localhost' to database 'cpi_mock'. Then I try to execute SHOW GRANTS It gives me something like
Grants for cpibetap#localhost
GRANT USAGE ON *.* TO 'cpibetap'#'localhost' IDENTIFIED BY PASSWORD '<password>'
GRANT ALL PRIVILEGES ON `cpibetap\_%`.* TO 'cpibetap'#'localhost'
Can anyone tell me what is meaning of above lines? How can I create database on my server?
If the user only have USAGE privilege it does not have access to create the database.
You write "It gives me something like", can you paste the actual response?
The Grant all statements is for the user cpibetap_%, the _ requires a character and the username is only cpibetap thus not having any extra character.
Related
I switch to MySQL 8 recently; earlier I was using MySQL 5.7 in GCP. I know questions like this have already been asked, but I didn't have any luck. My question is, I want to create a new user just say 'user1' and grant all privileges to a user account on all databases.
The query I am using for user creation:
CREATE USER 'user-1'#'%' IDENTIFIED BY 'user_password';
For privileges:
GRANT ALL PRIVILEGES ON *.* TO 'user-1'#'%';
This privileges query used to work on MySQL 5.7, but when I try to run this query in MySQL 8, I get this error (I logged in as root user and MySQL is in GCP):
SQL Error (1045): Access denied for user 'root'#'%' (using password: YES)
I also tried to run this query one after another like this:
CREATE USER 'user-1'#'%' IDENTIFIED BY 'user_password';
GRANT ALL PRIVILEGES ON *.* TO 'user-1'#'%';
But still I get the same error. I came to know that in MySQL 8 localhost root user have all the privileges, but my server is in Google Cloud, so how can I grant all the privileges to the user I created?
When I run this query in the mysql-8 (I am using HeidiSQL to connect the DB and run query)
SELECT * FROM mysql.user;
I got this output:
In this there are two root users:
For one host is localhost/127.0.0.1 (With all the privilege).
For other host is % (Not have any privilege).
I think I logged in as a user with host-% because my server is in GCP, that's why I cannot give any privilege to the user that I have created. So is there any way to give full permission to the
root#%
so that I can give full permission to the other users, Because I don't think there is any way to log in as a root#localhost
The problem here is that you are trying to create a super user, which is not something supported in cloud SQL, as you can see in this documentation:
Cloud SQL does not support SUPER privileges, which means that GRANT ALL PRIVILEGES statements will not work. As an alternative, you can use GRANT ALL ON %.*.
This alternative mentioned could be enough to grant the permissions you expected.
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..
I created user wanghao in MySQL and I want to create database in wanghao but an "access denied" error occurred. I want to create a database in user wanghao directly instead of using the following method.
create database exdb
grant all privileges on exdb.* to wanghao#localhost identified by 'wanghao'
You can do this like
GRANT ALL PRIVILEGES ON exdb.* To 'wanghao'#'hostname' IDENTIFIED BY 'password';
You must have the single quotes in there. 'localhost' tells MySQL you only want it from the same machine.
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.
I want to create a new mysql user and database demo in my company. Here is the commands i input in the mysql.exe :
create user 'admin'#'localhost' identified by 'admin';
create database dem;
Everytime i have that response:
access denied for user ''#'localhost' to database.
Actually i refered to that similar question :
MySQL - Access denied for user
Can anyone help please ???
I would suggest creating the database first then you can create a user, and use the GRANT option to allow permissions to that user for whatever you find necessary. However, creating a user first then a database while it's able to "potentially" work, isn't the best practice with MySQL. So you want to effectively do the Steps as such:
Create Database
Create User
GRANT permissions
???
Profit
You have to GRANT access to admin for dem.
GRANT ALL PRIVILEGES ON *.* TO 'admin'#'%' WITH GRANT OPTION;
You may have to also GRANT the same for admin#localhost as well. IIRC if you ever logon remotely with admin you would inherit the base privileges unless otherwise GRANTed
You can find many answers HERE.