How do I reset mysql password in macOS? [duplicate] - mysql

I have tried query but error
anybody solved the error?
MariaDB [mysql]> UPDATE user SET Host='%' WHERE User='root';
ERROR 1356 (HY000): View 'mysql.user' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them

MariaDB-10.4+ the mysql.user is a view rather than a table.
Its recommend to stop copying off old blogs to do any authentication relates changes in MySQL and MariaDB, the mechanisms are being updated and no longer apply. Always check the official documentation.
Use SET PASSWORD or ALTER USER to manage user authentication.
Also modifying a user/host component of the username will put triggers, events, plugins, grants, roles etc out of sync with the combined username (aka broken). So just DROP/CREATE users rather than manipulate them.

Related

MySQL ERROR 1396 (HY000): Operation DROP USER failed for 'username'#'localhost'

The software im using automatically creates 2 mysql users during installation. Because of a slight issue those users were created wrongly and the Support advised me to remove the users form the database and then recreate them using the installer (theres a separate option to just create the database users).
The two users are 'username'#'localhost' and 'username'#'%' (yes, they have the same username on different hosts..)
My problem is that neither DROP USER 'username'#'localhost'; nor DROP USER 'username'#'%'; work, both throw an ERROR 1396.
My guess would be that it has to do with the user accounts "owning" elements in the database which would be orphaned. Is there a way to get past this and remove the users anyways? (Since they are gonna be recreated in a second?)
Clarification: Im using the mysql root user.
Ergest Basha's suggestion in this comment worked for me:
You could try deleting from mysql database. use mysql; then delete from user where user='username' and host ='localhost';

User has mysql permission for select only but phpMyAdmin allows edit

Why would a user with permission to only select be able to edit a record in phpMyAdmin? How can I prevent the edit?
This is the permissions screen:
If the user is able to edit and save the row in phpMyAdmin, it's because the rights at the MySQL level permit this action. Ultimately it's MySQL that controls what is possible, not phpMyAdmin. Note that it's a combination of username + hostname that applies, so maybe there is the same username with a different hostname that is defined. Also, there can be rights at the global, database, table and column levels.

Create user with no privileges in RDS for MySQL fails, error 1396 [duplicate]

This question already has answers here:
Creating A New MySQL User In Amazon RDS Environment
(5 answers)
Closed 7 years ago.
After going through all the motions to create a database instance on AWS using the RDS tool I've been able to access the database through MySQL Workbench. I've used the master username and password chosen on creation of the instance.
However I wish to create new users who have restricted privileges and can't seem to achieve this without returning an error.
As one can see I've tried it through workbench as well as gitbash and recieved the linked errors.
Here's an image of the interface. I've tried creating a user with zero privaleges and still the same error messages. I know the privilege SUPER can't be granted in RDS. Creating the user fails, without any grants.
The database I'm trying to create new users for is empty and I'm currently using the default VPC. Not sure if either of those affect this.
Any help is appreciated!
I haven't set up any EC2 instance or BD security group, not sure if that's also relevant (Even though I intend to setup in a VPC).
This wouldn't be related to security groups. Your RDS instance isn't actually aware of them -- they only control access to the host running the RDS instance at the TCP layer, in the AWS network.
Regarding your issue -- I think what you'll find is that you somewhere along the line actually did manage to create the user:
mysql> CREATE USER 'stackoverflow'#'%';
Query OK, 0 rows affected (0.01 sec)
mysql> CREATE USER 'stackoverflow'#'%';
ERROR 1396 (HY000): Operation CREATE USER failed for 'stackoverflow'#'%'
mysql> CREATE USER 'stackoverflow';
ERROR 1396 (HY000): Operation CREATE USER failed for 'stackoverflow'#'%'
mysql>
To see the user accounts on the server SELECT * FROM mysql.user;.
Note that user 'stackoverflow' and 'stackoverflow'#'%' refer to the same user, where #'%' means the user's login privilege is not restricted by source IP address or host by MySQL (it can and will still be restricted by the security group settings, as I'll show in some more detail, below).
The mysql.user table contains all of the accounts the server knows about. This table (and several other grant tables) can be manipulated manually, but it's best to use the GRANT, REVOKE, CREATE USER, and DROP USER statements.
Potentially helpful later... if you do set up the security group in such a way that you can't connect to the server (because your source IP address isn't permitted) this will not cause any behavior change on the part of MySQL -- your connection will simply time out, never actually reaching the server, regardless of username and password.
It's a common error you'll see entirely too many people making (including here on SO) to start dinking around with permissions on the server, when they encounter this specific problem -- don't do that -- the problem is always one of network connectivity if you see exactly the following behavior:
$ mysql -h my-rds-with-security-group-too-restrictive.jozxyqk.us-west-2.rds.amazonaws.com
ERROR 2003 (HY000): Can't connect to MySQL server on 'my-rds-with...' (110)
ERROR 2003 can mean several things... but the money is at the end of the line. That code (110) at the end is telling you you're never reaching the server -- it's not a permissions issue, if you see this exact code code. Look it up:
$ perror 110
OS error code 110: Connection timed out
(Linux error code 110 shown; Mac is probably the same code, since I suspect it's a standard POSIX error code, while Windows makes up their own. I believe it's 10060 on Windows that conveys the same meaning.)
Looks like a duplicate of this question: Creating A New MySQL User In Amazon RDS Environment
mysql -u [your_master_username] -p -h YOURRDSENDPOINT.rds.amazonaws.com
CREATE USER 'jeffrey'#'%' IDENTIFIED BY 'somepassword';
GRANT SELECT ON [your_database].[some_table] TO 'jeffrey'#'%';

Can I create Trigger on mysql base [duplicate]

I am trying to audit the privilege changes in mysql.user table by writing a trigger on it.
insert trigger: will capture who gave the new permissions and when
update trigger: will capture who changes the privileges from what[old privilege]
remove trigger: will capture who removed the privileges and what are they
Now, I am getting an error while writing like
ERROR 1465 (HY000): Triggers can not be created on system tables
Can we create a trigger on system tables, Is there any work around or it will be supported in higher versions[> 5.1.61] ?
Thanks in advance.
No we can not. Even if we have the best concerned privileges are all and super
See (All) and (Super) Privileges Provided by mySql
After trying all type of privileges like
grant super on *.* to root#localhost
grant all on *.* to root#localhost
I have tried simplest trigger on different tables mysql.db and got same error
Triggers can not be created on system tables // Please accept this
bitter truth
If you found anywhere that triggers can be created on system tables, simply that is wrong
Had you seen this: http://forums.mysql.com/read.php?99,207145 ?
The poster says he needed "SUPER PREVILAGES"
Do you have access to the root user for the database?

#1142 - INSERT command denied to user ___ for table ___

Apparently this is usually to do with size, but I only have one table with six columns.
The only thing that has changed recently is that today I installed a forum but I've removed it again and the problem persists.
I am entering the SQL manually in PHPmyAdmin.
Any idea what the problem could be?
I just faced that ERROR, and found that my QUERY state incorrect spelled DATABASE name. :(
The problem is about the user session cookies, so all you need to do is to delete those cookies by clicking on the icon at the top right below phpMyAdmin as mentioned in this mage:
Your user doesn't have INSERT privilege. Check user database privileges.
Maybe you changed user, maybe you just changed the HOST or the IP from where you are connecting.
Use this statement to grant the privilege.
GRANT INSERT ON databaseName TO 'user'#'66.40.52.21'