Granting privileges for Importing data to AWS Lightsail MySQL - 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...

Related

Change ddev password for a single project

I try to change a ddev database password for a single project.
I need to check sign-escaping for a project, because I want to know how and if that works.
How can I change a database password in a single ddev-project?
I use
Docker 3.5.1 (66090)
ddev 1.17.2
macOS Catalina 10.15.7
I got answers in slack, thanks for that, but I run into those errors, if I do so:
ddev mysql
MariaDB [db]> GRANT ALL PRIVILEGES ON *.* TO 'db'#'%';
ERROR 1045 (28000): Access denied for user 'db'#'localhost' (using password: YES)
MariaDB [db]> ALTER USER 'db'#'localhost' IDENTIFIED BY 'test/test:test#test?test#test&test"';
ERROR 1227 (42000): Access denied; you need (at least one of) the CREATE USER privilege(s) for this operation
MariaDB [db]> ALTER USER 'db'#'db' IDENTIFIED BY 'test/test:test#test?test#test&test"';
ERROR 1227 (42000): Access denied; you need (at least one of) the CREATE USER privilege(s) for this operation

Importing sql file in workbench

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'

How to grant privileges to root in mysql through SSH

I am trying to install the Clouse script on our server and I am connecting via SSH.
Everytime I get to the install part in SSH I am getting this error:
ERROR 1142 (42000) at line 1: INSERT command denied to user 'root'#'localhost' for table 'plugin'
I tried connecting to mySQL by typing my in the command line, once I am connected I try running this (for demo purposes this is false info - skittles would be my database, password1234 would be the password):
GRANT ALL ON skittles.* TO root#'localhost' IDENTIFIED BY 'password1234';
It tells me success that 0 rows were effected in 0 seconds and then I use FLUSH PRIVILEGES
then quit and try to install again and keep getting the same error. Is there something I am doing wrong in the command line with the GRANT ALL ? Not sure why it is not working, not familiar with SSH to much so I would appreciate any insight

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';

mysql: finding username

I have mysql installed on my Mac and when i check the system preferences it shows that it is running.
When, while trying to follow a tutorial, I try to create a database
mysql> create database tinyclone;
I get this error
mysql> create database tinyclone;
ERROR 1044 (42000): Access denied for user ''#'localhost' to database 'tinyclone'
Before creating the database, the author of the book does
mysql –u <username> -p <password>
However, I don't know my username, and I'm not 100% sure I know my password either.
I tried to do
sudo create database tinyclone;
and I got a different error message. Not sure what the problem with my syntax was
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 'sudo create database tinyclone' at line 1
Question, so that I can follow along with the book's author, anyone know how I can find out my mysql username and password?
I get this error
mysql> create database tinyclone;
ERROR 1044 (42000): Access denied for user ''#'localhost' to database 'tinyclone'
You're not logged in as any user (hence the ''#'localhost' bit). As others have suggested, try doing mysql -uroot -proot or mysql -uroot.
However, I don't know my username, and I'm not 100% sure I know my password either.
There is (almost) always a 'root' user created by default, usually with no password, unless you specified one when initially installing/configuring mysql.
I tried to do
sudo create database tinyclone;
and I got a different error message. Not sure what the problem with my syntax was
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 'sudo create database tinyclone' at line 1
sudo is not an SQL command. You cannot use it inside mysql. Instead log into sql with the 'root' user.
Also, please note that the mysql root user is not the same as your computer's root user.
C.5.4.1.3. Resetting the Root Password: Generic Instructions
http://dev.mysql.com/doc/refman/5.0/en/resetting-permissions.html
You miss CREATE privilege.
Connect as a root user, create new user and grant CREATE privilege -
CREATE USER 'user1'#'localhost';
SET PASSWORD FOR 'user1'#'localhost' = PASSWORD ('your_password');
GRANT Create ON *.* TO 'user1'#'localhost'
Then connect as 'user1'#'localhost' -
mysql> --user=user1 --p=your_password
...and create new database -
CREATE DATABASE tinyclone;
Usually when you install mySQL you're prompted for password for the admin user (root) if you skipped it the only user currently available for mysql is root and that user doesn't have password enabled (which isn't a great idea for production environment)
So, what you should do is:
~$ mysql -u root
then
create database tinyclone