Today I came to the realization that I cannot add or delete any of the databases that belong to any of my clients on my Plesk server.
I had been receiving this error:
Error: Unable to remove some of the selected databases. The user
specified as a definer ('root'#'localhost') does not exist
So I found and ran this fix:
# plesk db
# CREATE USER 'root'#'localhost' IDENTIFIED BY 'password';
Now when trying to add or remove a database I receive a new error:
Error: Connection to the database server failed: View 'mysql.user'
references invalid table(s) or column(s) or function(s) or
definer/invoker of view lack rights to use them
(I'm not sure if it is related or not, but I updated MariaDB a few days ago. I'm pretty sure that I created a new database after doing so though).
CentOS Linux 7.7.1908 (Core) |
Plesk Onyx |
Version 17.8.11 Update #80 |
mysql 10.4.11-1.el7.centos |
10.4.11-MariaDB MariaDB Server
Seems root#lo...got removed when you upgraded MariaDB few days ago.
Choice 1:
It would have removed root#127... also and you would have used both root user references to your databases, connected dbs, views, etc. Views mainly as the error points to that also. So try this too.
CREATE USER 'root'#'127.0.0.1' IDENTIFIED BY 'password';
Choice 2:
After re-creating root, try
flush privileges
If not Ok, you shall restart mysql and try.
systemctl restart mariadb.service
Related
I have an issue with connection to MySQL database.
Internet says that error Unable to load authentication plugin 'caching_sha2_password' can be fixed with ALTER USER 'root'#'localhost' IDENTIFIED WITH mysql_native_password BY '123';.
The issue is that this command doesn't work. ALTER USER 'root'#'%' IDENTIFIED WITH mysql_native_password BY '123'; also doesn't work.
First command affects 0 rows and has an error 1 factor authentication method does not match against authentication policy. Please refer ##authentication_policy system variable., second one returns an error Operation ALTER USER failed. Of course I'm replacing 123 with my real admin password.
I'm absolutely out of ideas, I hope I can get some clues why this command doesn't work.
Edit
I think the only solution is to uninstall newest MySQL version and install an older one that actually works. Topic closed.
You need to FLUSH PRIVILEGES after a user update command.
I've two ubuntu host, host01 is the DB Server in host02, and I need to install a PHP Application.
Both hosts are in the same network (172.22)
The installation process requires a user with administrative rights to:
create a database (DBX)
assign grants to the database, for a user.
I've added manually the user (admin) in MariaDB in this way:
CREATE USER 'admin'#'172.22.%.%' IDENTIFIED BY 'xxxxxxx';
I have no issue to create the database from host02, but when I try to run the following SQL
GRANT SELECT, UPDATE, DELETE, INSERT ON DBX.* TO 'admin'#'172.22.%.%';
I'm always getting:
Access denied for user 'admin'#'172.22.%.%' to database 'DBX'
The issue happens when the query is run from the PHP Application, and also if I use the mariadb client from host02, then it seems not related to PHP.
Any idea?
I am creating a Laravel App and testing it in production mode on a fresh installation of Ubuntu 19.10.03. Fresh LAMP installation (PHP 7.3, MySQL 8.0.19-0).
I can create a new database, and a new user that has full access to the database, but Laravel requires that the user have the SELECT option from the 'information_schema' database as well. Here is the process I am using:
$ sudo mysql
mysql> CREATE DATABASE IF NOT EXISTS `my-laravel-database`;
mysql> CREATE USER IF NOT EXISTS 'laravelUser'#'localhost' IDENTIFIED WITH mysql_native_password BY 'myPass';
mysql> GRANT ALL PRIVILEGES ON `my-laravel-database`.* TO 'laravelUser'#'localhost' WITH GRANT OPTION;
mysql> GRANT SELECT ON `information_schema`.* TO 'laravelUser'#'localhost';
The last command always returns
ERROR 1044 (4200): Access denied for user 'root'#'localhost' to database 'information_schema'
I have tried running the mysql_secure_installation command to set the root password, this did not help. I can run the app as the root user, but I do not want to do this in production.
I have also tried a fresh installation of Ubuntu with just the LAMP services installed.
I wasted DAYS on something tangential to this problem. The answer was in the MySQL manual:
For most INFORMATION_SCHEMA tables, each MySQL user has the right to access them, but can see only the rows in the tables that correspond to objects for which the user has the proper access privileges.
So you can't grant permission to INFORMATION_SCHEMA directly, you have to grant permission to the tables on your own schemas, and as you do, those tables will start showing up in INFORMATION_SCHEMA queries.
Unfortunate, because I'd love have a user who's able to see INFORMATION_SCHEMA, but not the content of the actual tables, and there doesn't seem to be a way to do that.
Try the following:
USE mysql;
ANALYZE TABLE db;
In case table is broken run the following:
REPAIR TABLE db;
Then restart MySQL server.
I'm trying to migrate a db with Sequelize working with MySQL 8.0.15, but I'm not able to do that. I keep receiving this error message.
Sequelize CLI [Node: 10.15.0, CLI: 5.4.0, ORM: 5.3.5]
Loaded configuration file "config/config.json".
Using environment "development".
ERROR: Client does not support authentication protocol requested by server; consider upgrading MySQL client
I've tried every single solution for this problem. The thing is when i try to change the MySQL root password the message i get is this one:
ERROR 1819 (HY000): Your password does not satisfy the current policy requirements
Then I did try to change the password validate policy following this procedure
https://dev.mysql.com/doc/refman/5.6/en/validate-password-installation.html
then MySQL crashed cause it's deprecated. Then I tried this one
https://dev.mysql.com/doc/refman/8.0/en/validate-password-installation.html
Then I got this
mysql> INSTALL COMPONENT 'file://component_validate_password';
ERROR 3529 (HY000): Cannot load component from specified URN:
'file://component_validate_password'.
Then I checked where the component is
ls /usr/lib64/mysql/plugin/component_v*
/usr/lib64/mysql/plugin/component_validate_password.so
Anyone can help? I'm realy out of options, now!
Thanks in advance
If you want to use MySQL 5.x style authentication, typically all you have to do is add this to your my.cnf:
[mysqld]
default_authentication_plugin=mysql_native_password
Do this before adding any users. Only use users for connecting via Sequelize, never root.
If you are using MySQL 8.0 then https://dev.mysql.com/doc/refman/5.6/en/validate-password-installation.html then this shouldn't work.
Have used mysql_secure_installation and installed the validate_password_component then?
If yes, in that case, the plugin must already be installed and all you need to do is set validate_password related parameters in the options file (default /etc/my.cnf) and some options require a server restart.
For those who cannot edit system variables (for instance, if you're using a managed database in AWS or DigitalOcean), this works as well:
ALTER USER 'foo'#'bar' IDENTIFIED WITH mysql_native_password BY 'password';
flush privileges;
Or, if you cannot run flush privileges; like me:
DROP USER 'foo'#'bar';
CREATE USER 'foo'#'bar' IDENTIFIED WITH mysql_native_password BY 'password';
GRANT INSERT, SELECT, ... ON mydb.* TO 'foo'#'bar';
I'm unable to create a schema on freshly set-up MySql Cluster 7.4.7 on single windows machine. It fails with error ERROR 1044 (42000): Access denied for user ''#'localhost' to database 'my_schema'. What is it that I'm missing? During installation I was not asked for username and password for MySql, so what are the defaults?
Also to give detail on how I set-up (in case that is not proper), I following this tutorial and using default settings on new cluster wizard, I have been able to successfully run 2 Multithreaded data node (ndbmtd.exe), 1 Management Node (ndb_mgmd.exe), 2 SQL Node (mysqld.exe). I also stopped mysql server 5.5 running on my machine previously. Then, using command line and typing mysql I'm able to connect and show databases; result in 2 schemas:
information_schema
test
Thanks in advance.
After further trying, I've been able to get away with both the problems above:
Instead of create schema, I used create database and it worked.
By default there is no password. I'm able to connect with user as root without any password.