I reinstalled the server running MySQL. I had created a backup of the database by using MySQL Workbench. Now I'm trying to import the dump in to the database trough the same program but I get the following error:
ERROR 1142 (42000) at line 656: SELECT,LOCK TABL command denied to user 'root'#'MIKKOS' for table 'events_waits_summary_by_thread_by_event_name'
I tought that root had full privileges. I ran the following but the same error appears with the previous query after executing this:
GRANT ALL PRIVILEGES ON *.* TO 'root'#'%' WITH GRANT OPTION
It also appears when running locally (root#localhost).
What to do?
Check which databases MySQL Workbench included in the dumpfile. I believe it defaults to dumping everything, including DBs like user and performance_schema. Those are the problem, your grant tables are probably fine.
Remove the unneeded databases, especially performance_schema and MySQL will likely import the dumpfile without errors.
You need to repair internal table structure after reinstallation a newer MySQL server. To do so try:
REPAIR TABLE `events_waits_summary_by_thread_by_event_name`;
It would be better to drop database and restore it from full mysql database dump if you have one.
Related
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.
Unexpected exception MySQLSyntaxErrorException: SQL error when doing: Taking a connection from the data source
SQL exception: Unknown database 'teamcitydb'
I'm getting this error when I open the Web UI for the TeamCity server in firefox, and I'm not sure why it can't take a connection to this database. I followed all the steps in the installation procedure.
Any help or guidance would be appreciated!
It seems you have not create for database in the MySQL correctly.
According to the latest manual, you should run below command after connecting to the MySQL:
create database teamcitydb collate utf8_bin;
create user <user-name> identified by '<password>';
grant all privileges on <database-name>.* to <user-name>;
grant process on *.* to <user-name>;
I'm trying to use mysqldump in my server, from the command line.
root#xxxxx:/xx/xx/xx/backups/09-03-13# mysqldump db_name_xxxx --tab=. --user=xxxx
--password=xxxxx
mysqldump: Got error: 1045: Access denied for user 'xxxxx'#'localhost' (using
password: YES) when executing 'SELECT INTO OUTFILE'
So I assume it's a problem with username/password.
However, I can get into the MySQL command line fine using mysql, with exactly the same logon details.
What could be causing mysqldump to fail, but not mysql?
Your problem is not with the login details but with the user you are logging in as.
In order to carry out a mysqldump you need at least SHOW DATABASES, SELECT, LOCK privileges on every table in the database. Things get more complicated if you use more exotic options such as locking etc.
This is a faily good reference for what permissions you need for what options in mysqldump.
I have an install script that sets up a MySQL user + database + some tables. It worked fine in mysql 5.0, but we recently upgraded to Ubuntu 12.04, which ships with mysql 5.5. However in mysql 5.5 I am getting errors.
The problem seems to be related to adding users. I use a line like this to create a root user, which is later used to login with and set up the rest of the stuff:
INSERT INTO mysql.user VALUES('%','myrootuser','','Y','Y','Y','Y','Y','Y','Y',
'Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y',
'Y','Y','','','','',0,0,0,0,'','');
flush privileges;
The command succeeds. However, when logging in with this new 'myrootuser', the user doesn't seem to have sufficient privileges:
jeroen#jeroen-ubuntu:~$ mysql -u myrootuser -e 'select * from mysql.user;'
ERROR 1142 (42000) at line 1: SELECT command denied to user ''#'localhost' for table 'user'
Also I noticed that I can login with non existing usernames, which might be obfuscating the real problem:
ubuntu#myserver:~$ mysql -u thisuserdoesnotexist
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 40
Server version: 5.5.22-0ubuntu1 (Ubuntu)
mysql>
Has there been some change in the MySQL authentication in 5.5 that I am not aware of?
For the user creation problem, try using phpMyAdmin to add it. PMA is better than SQL query!
For your login problem, delete the user * in the user list (use PMA). It will fix your problem! I got the same problem and I did that to fix it.
In phpMyAdmin, I accidently deleted the 3 root users, when I add mysql_grant_tables or whatever it says they're still there.
I try and run this and it says this.
mysql> grant all privileges on . to 'root'#'localhost' identified by
"" with grant option; ERROR 1290 (HY000): The MySQL server is running
with the --skip-grant-tables option so it cannot execute this
statement
Is there a way that I can get these users back up and running again?
Manually Backup (COMPY) your own databases from data folder from
MySQL
Manually Backup (COMPY) your website(s)
Uninstall XAMPP and setup new one.