Importing sql file in workbench - mysql

I have an sql file called backup.sql, I'm trying to import this file using workbench, but at some point, I get this error:
Error:
ERROR 1142 (42000) at line 1758: SELECT, LOCK TABLES command denied to user 'root'#'localhost' for table 'events_waits_summary_by_thread_by_event_name'
Operation failed with exitcode 1
I tried the following sql statement, but nothing changed.
GRANT SELECT,LOCK TABLES ON *.* TO 'root'#'localhost'

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...

XAMPP MySQL ERROR 1114 (HY000): The table 'db' is full

I am trying to grant all privileges to a user for a new database I have created.
The command I run is as follows:
GRANT ALL PRIVILEGES ON 'dbname'.* TO 'user'#'localhost' IDENTIFIED BY 'password';
However, mySQL returns an error:
ERROR 1114 (HY000): The table 'db' is full
I am puzzled as I faced no such error previously when granting user access to other databases.
I have enough disk space and my setup for the innodb_data_file_path is as follows:
innodb_data_file_path=ibdata1:10M:autoextend
What am I missing here and how should I fix this error?

mysql> ERROR 1044 (42000): Access denied for user 'root'#'localhost'

Initially I tried to setup a connection between MySQL and Node.JS and got error ER_NOT_SUPPORTED_AUTH_MODE, which I tried to fix by issuing ALTER USER 'root'#'localhost' IDENTIFIED WITH mysql_native_password BY 'password' and flushing privileges as described here. But after that I got another error ER_ACCESS_DENIED_ERROR: Access denied for user 'root'#'localhost', which I tried to solve by dropping and creating new user, among other steps as suggested on this page.
However, now I am unable to create any database at all, getting ERROR 1044 (42000): Access denied for user 'root'#'localhost' to database 'test'. I login successfully to MySQL command line client with the password that I setup during the installation but it seems I am not allowed to perform any operation there. How could I restore my privileges to create databases on MySQL v 8.0 on Windows 10?
Here is some other output which I get after issuing certain commands:
mysql> select user(), current_user;
+----------------+----------------+
| user() | current_user |
+----------------+----------------+
| root#localhost | root#localhost |
+----------------+----------------+
1 row in set (0.00 sec)
mysql> CREATE DATABASE test;
ERROR 1044 (42000): Access denied for user 'root'#'localhost' to database 'test'
mysql> mysql -u root -p;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'mysql -u root -p' at line 1
mysql>

why the following errors occurs in creation of databases?

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;

How to get dump of database if I only have select privileges on it

How to get dump of database if I only have select privileges on it. It is giving access denied error when I am running mysqldump command.
I am getting following error:
mysqldump: Got error: 1044: Access denied for user 'sangeeta'#'%' to database 'abc' when doing LOCK TABLES
Thanks!!
Two options:
You really get an access denied error. Error message is clear, you don't have select privileges.
You get a message that you don't have the privilege to lock the tables.
Solutions for number 2:
Use the --lock-tables=false option for non-InnoDB tables or the --single-transaction option for InnoDB tables.