Change ddev password for a single project - mysql

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

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

Database permits main user 'in' but cannot 'see' any schemas

I'm on RDS and this is the situation:
Unable to progress with my RDS instance.
RDS instance master user is 'admin'
Can connect up to the instance using the admin user (MySQL WB or commandLine):
C:\Users\xx>mysql -u 'admin' -p --host=md-blahblah-db-instance.blahblah.ap-southeast-rds.amazonaws.com
Enter password: ********
Welcome to the MySQL monitor. etc etc
Type '\c' to clear the current input statement.
Now I'm in but (on MySQL WB or commandLine) cannot 'see' schema:
mysql> use uxxx
ERROR 1044 (42000): Access denied for user 'admin'#'fxxxx.lnk.telstra.net' to database 'uxxx'
mysql> GRANT ALL PRIVILEGES ON umb.* TO 'admin'#'%' WITH GRANT OPTION;
ERROR 1044 (42000): Access denied for user 'admin'#'fxxxx.lnk.telstra.net' to database 'uxxx'
mysql> GRANT ALL PRIVILEGES ON umb.* TO 'admin'#'%' IDENTIFIED BY 'somepass';
ERROR 1044 (42000): Access denied for user 'admin'#'fxxxx.lnk.telstra.net' to database 'uxxx'
mysql> CREATE USER test identified by 'password';
ERROR 1227 (42000): Access denied; you need (at least one of) the CREATE USER privilege(s) for this operation
mysql> flush privileges;
ERROR 1227 (42000): Access denied; you need (at least one of) the RELOAD privilege(s) for this operation
Have tried using ideas from the accepted answer at User cannot see databases in mysql workbench
but can't progress as can't create another user.
MySQL ERROR 1045 (28000): Access denied for user 'bill'#'localhost' (using password: YES) suggests that I have could possibly have another user named admin#'fxxxx.lnk.telstra.net', hence this problem.
Quoting:
Hence, such an anonymous user would "mask" any other user like '[any_username]'#'%' when connecting from localhost.
'bill'#'localhost' does match 'bill'#'%', but would match (e.g.) ''#'localhost' beforehand.
The recommended solution is to drop this anonymous user (this is usually a good thing to do anyways).
Reluctant to start again as a lot of CloudFormation stacks are associated with this database.
Any ideas? Appreciate all help.

unable to create database in mysql or via ssh

I m trying to create new database through mysql or ssh but on both m getting error
mysql : CREATE DATABASE porto;
Error : Access denied for user 'root'#'localhost' to database 'porto' on ssh : ERROR 1044 (42000): Access denied for user 'root'#'localhost' to database 'porto'
mysql> CREATE USER 'testuser'#'localhost' IDENTIFIED BY 'ecomaddon#42';
ERROR 1227 (42000): Access denied; you need (at least one of) the CREATE USER privilege(s) for this operation
mysql> SELECT User,Host From mysql.user;
ERROR 1142 (42000): SELECT command denied to user 'root'#'localhost' for table 'user'
Its problem of privilege but don't know how give root user all privilege ai had try all methods but got nothing.
You can try to access as root
mysql -h 127.0.0.1 -P 3306 -u root -p
If it still does not work follow this guide
https://www.a2hosting.com/kb/developer-corner/mysql/managing-mysql-databases-and-users-from-the-command-line
you may be login as root but the root#localhost is not allowed for the actions you are executing.
mysql>CREATE USER 'root'#'localhost' IDENTIFIED BY 'enter_your_password_here';
mysql>exit
then try logging-in again
I think it's rights issue & It can be resolved by re configuring again. Here's a steps to reconfigure it.
Stop the current MySQL server instance:
sudo service mysql stop
Use dpkg to re-run the configuration process that MySQL goes through on first installation. You will again be asked to set a root password.
sudo dpkg-reconfigure mysql-server-5.5
Thanks for reply to all
i had solve i
1. first login to new user.
2. give access all to that users by update command .
3. drop root user and rename second user to root.
main problem was : when we create root it didn't give grant_priv field access users .

Privileges issue

I have a mysql database (version 5.5), and I am trying to add a new user.
But I don't have the privileges to create it.If I try to show the list of all users:
select * from mysql.user;
It gives this error:
ERROR 1142 (42000): SELECT command denied to user ''#'localhost' for table 'user
It seems like I am not able to do anything.How to grant the privileges for a user without using the grant command?
There's a way? I also tried this:
CREATE USER 'ramy'#'localhost' IDENTIFIED BY 'pass';
It says:
ERROR 1227 (42000): Access denied; you need (at least one of) the CREATE USER privilege(s) for this operation
I don't see any way to handle privileges, mysql show have a method to handle privileges for who have newly created a database.That's a vicious circle.
You need to login as the 'root' account
See this if you don't know the root password
http://dev.mysql.com/doc/refman/5.0/en/resetting-permissions.html

I am logged into mysql as root but cannot grant extra privileges to users

I am logged into mysql as the root user and trying to setup MYSQL Replication. I have already setup my database as a Master but when I try the 'show master status;' command its saying:
ERROR 1227 (42000): Access denied; you need the SUPER,REPLICATION CLIENT privile
ge for this operation
When I try and add these privileges to the root user I am getting:
ERROR 1045 (28000): Access denied for user 'root'#'%' (using password: YES)
Im lost as to what I can do at this point.
Any help would be greatly appreciated,
Thanks in advance!
It might be necessary that you have to be on localhost, not on a remote machine.