why the following errors occurs in creation of databases? - mysql

I tried to create databases but the following error occurs?
mysql> create database sample;
ERROR 1044 (42000): Access denied for user 'db_cad'#'%' to database 'sample'

your user "db_cad" don't have rights to create table after connecting to from another machine on sample database.
using following commands you can check your rights.
show grants;

Related

Granting privileges for Importing data to AWS Lightsail MySQL

I have a MySQL database running on AWS Lightsail. I'm trying to import data into MySQL using MySQL Workbench, but see following error:
ERROR 1227 (42000) at line 20: Access denied; you need (at least one of) the SUPER, SYSTEM_VARIABLES_ADMIN or SESSION_VARIABLES_ADMIN privilege(s) for this operation
Upon trying to grant access to dbmasteruser using following command:
UPDATE mysql.user SET Super_Priv='Y' WHERE user='dbmasteruser' AND host='%';
I see following error:
ERROR 1054 (42S22): Unknown column 'ERROR (RDS): SUPER PRIVILEGE CANNOT BE GRANTED OR MAINTAINED' in 'field list'
Using following command:
mysql> GRANT SUPER ON *.* TO dbmasteruser#'%';
I see following error:
ERROR 1045 (28000): Access denied for user 'dbmasteruser'#'%' (using password: YES)
I seems I stuck in a loop: I cannot import data and dbmasteruser doesn't have privileges neither to import nor to grant certain privileges to import.
I also see rdsadmin user with DBA privileges, but no idea where to get password in Lightsail for this user.
I had the same issue: I exported an existing database with MySql Workbench (this was an older MySQL version) and tried to import it into my AWS Lightsail Database - wich didn't work.
The reason were some operations in the mysql dump, which are not allowed for the Lightsail user. I just commented out the mentioned lines and the import worked as expected (in your case it's line 20).
For me I needed to comment out the following statements:
-- All lines that begin with
SET ##SESSION.SQL_LOG_BIN...
SET ##GLOBAL.GTID_PURGED...

Mysql Mariadb user not able to access DB

I created a schema and granted its permission to a specific user:
GRANT ALL PRIVILEGES ON USED_CARS.* TO ANDREW#LOCALHOST;
The database is created with root user and then granted these permissions to another user. now when I swith to another account I can list the schema with SHOW SCHEMAS; query however cannot switch to that DB with use USED_CARS; query.
Following error pops up:
ERROR 1044 (42000): Access denied for user 'ANDREW'#'localhost' to database 'USED_CARS'
What am I missing here? Thanks for the help in advance.
Sometimes depending on the configuration of server, you can use localhost or the ip:127.0.0.1
Could you try with this ...
GRANT ALL PRIVILEGES ON USED_CARS.* TO 'ANDREW'#'%';

google cloud sql -- mysql import issue

I am trying to import a table in a newly created instance in google MySQL cloud but I get the following error message:
Error 1142: INSERT command denied to user 'cloudsqlimport'#'127.0.0.1' for table
When I try to grant the privileges to cloudsqlimport from cloud sql console:
mysql> UPDATE `mysql`.`user` SET `insert_priv` = 'Y' WHERE `User` = 'cloudsqlimport';
ERROR 1142 (42000): UPDATE command denied to user 'root'#'104.xxx.xx.xx' for table 'user'
mysql> UPDATE `mysql`.`user` SET `Grant_priv` = 'Y' WHERE `User` = 'root';
ERROR 1142 (42000): UPDATE command denied to user 'root'#'104.xxx.xx.xx' for table 'user'
Same issue when I try to grant the 'insert_priv' through MySQL workbench
How can I resolve this issue?
This error might be due to one of the following causes:
1- Lack of permissions
2- Database or Table spelled wrongly.
3- User correctly spelled but the IP is not correct.
To see the permissions your user has, Please log into MySQL prompt with your user, and run the following command:
SHOW GRANTS;
This will show you the privileges (grants in MySQL) that the current user has. Please check if you have INSERT privileges for the given table.

xampp Creating Databases Error 1044 (42000)

I tried to create a database using MySQL. I encountered this problem. How can I fix it?
ERROR 1044 (42000): Access denied for user ''#'localhost' to database
'sample_db'
You should check user privileges, there are users take privileges on specific database only, and others are super users who take all privileges and through this users you can create database.
You can see that through phpMyAdmin application and can access it by:
Http:\localhost\phpMyAdmin

MySQL access denied for multiple users

I'm playing around with MySQL and Django and I'm having some trouble because I'm new to this.
I'm trying to run the command:
python manage.py sql login
to add login to my apps and I get the error:
OperationalError: (1044, "Access denied for user 'classdummy'#'localhost' to database 'classydummy'")
I tried looking for the database 'classdummy' and user 'classdummy'#'localhost' but I didnt see them so I tried to create both
I was successful in creating a database named 'classdummy' but when I try to create a user named 'classdummy'#'localhost' I get this error:
ERROR 1396 (HY000): Operation CREATE USER failed for 'classdummy'#'localhost'
I'm not sure if I'm doing all this correctly
Thank you for all the help!
if you can login to mysql as a privileged user, you can run a grant command:
grant all privileges on classdummy.* to 'classdummy'#'localhost' identified by 'mypassword123z';