InnoDB tables exist in MySQL but says they do not exist after copying database to new server - innodb

I used mysqldump to export my database and then I imported it into MySQL on my other server. I can now see all my tables if I do "show tables" but I can't actually select from or describe any of them.
ERROR 1146 (42S02): Table 'mydatabase.user' doesn't exist
All of my tables are InnoDB. I saw one issue people had where they were using old_passwords, so I explicitly set that to 0 in my.cnf and I made sure all of the passwords in the mysql table were 41 hexadecimal digits as they should be for the new passwords.

The reason "show tables;" works is because mysqld will scan the database directory for .frm files only. As long as they exist, it sees a table definition.
If you imported the data into MySQL and this error message happens, the first thing I would immediately do is run this command: (BTW This is MySQL 5.1.45, but works in MySQL 5.x anyway)
mysql> show engines;
+------------+---------+----------------------------------------------------------------+--------------+------+------------+
| Engine | Support | Comment | Transactions | XA | Savepoints |
+------------+---------+----------------------------------------------------------------+--------------+------+------------+
| InnoDB | YES | Supports transactions, row-level locking, and foreign keys | YES | YES | YES |
| MRG_MYISAM | YES | Collection of identical MyISAM tables | NO | NO | NO |
| BLACKHOLE | YES | /dev/null storage engine (anything you write to it disappears) | NO | NO | NO |
| CSV | YES | CSV storage engine | NO | NO | NO |
| MEMORY | YES | Hash based, stored in memory, useful for temporary tables | NO | NO | NO |
| FEDERATED | NO | Federated MySQL storage engine | NULL | NULL | NULL |
| ARCHIVE | YES | Archive storage engine | NO | NO | NO |
| MyISAM | DEFAULT | Default engine as of MySQL 3.23 with great performance | NO | NO | NO |
+------------+---------+----------------------------------------------------------------+--------------+------+------------+
8 rows in set (0.00 sec)
If the server you imported the data into says InnoDB is disabled, then you have a big problem. Here is what you should do:
1) Drop all the Data from the New Import DB Server
2) Cleanup InnoDB Setup
3) run SHOW ENGINES; and make sure InnoDB is fully operational !!!
4) Reload the mysqldump into the new import server
Give it a Try !!!

I had this problem when I changed from a windows server to a Linux server.
Tables are files, and windows files are case insesitive, but linux files are case sensitive.
In my aplication, in the sql queries, some times I used uppercase tablenames and other times lowercase, so, sometimes I obtained the same result as you.

I my case it was SQLCA.DBParm parameter.
I used SQLCA.DBParm = "Databse = "sle_database.text"" but it must be
SQLCA.DBParm = "Database='" +sle_database.text+ "'"
Explain : you are going to combine three strings :
a) Database=' - "Database='"
b) (name of the database) - +sle_database.text+
c) ' - "'"

Related

How to modify MariaDB SQL Error Log plugin system variables?

I just installed this plugin to monitor SQL errors:
https://mariadb.com/kb/en/sql-error-log-plugin/
but I can't for the life of me find anything on how to modify the default system variables for that error log plugin, and where.
Anyone?!
You can't modify error plugin log variables via SQL statements. They are either read-only and/or they need to be specified at startup (see source code).
So you have to pass these values either to mariadbd/mysqld or you have to specify these in your configuration file.
Example in /etc/my.cnf:
[server]
sql-error-log-filename=foo.log
sql-error-log-rotate=ON
restart server and check the values
MariaDB [test]> show variables like 'sql_error%';
+--------------------------+---------+
| Variable_name | Value |
+--------------------------+---------+
| sql_error_log_filename | foo.log |
| sql_error_log_rate | 1 |
| sql_error_log_rotate | ON |
| sql_error_log_rotations | 9 |
| sql_error_log_size_limit | 1000000 |
+--------------------------+---------+

How to edit the existing SQL file in Flyway

I am working with flyway Db migration, and I have download flyway zip folder and placed into my local computer.
I have two files in the sql folder, i.e V1__Create_person_table.sql and V2__Add_people.sql.
Flyway info
Flyway Community Edition 5.2.4 by Boxfuse
Database: jdbc:h2:file:./foobardb (H2 1.4)
Schema version: << Empty Schema >>
+-----------+---------+---------------------+------+--------------+---------+
| Category | Version | Description | Type | Installed On | State |
+-----------+---------+---------------------+------+--------------+---------+
| Versioned | 1 | Create person table | SQL | | Pending |
| Versioned | 2 | Add people | SQL | | Pending |
+-----------+---------+---------------------+------+--------------+---------+
Flyway migrate
Flyway Community Edition 5.2.4 by Boxfuse
Database: jdbc:h2:file:./foobardb (H2 1.4)
Successfully validated 2 migrations (execution time 00:00.020s)
Creating Schema History table: "PUBLIC"."flyway_schema_history"
Current version of schema "PUBLIC": << Empty Schema >>
Migrating schema "PUBLIC" to version 1 - Create person table
Migrating schema "PUBLIC" to version 2 - Add people
Successfully applied 2 migrations to schema "PUBLIC" (execution time 00:00.092s)
Flyway info
Flyway Community Edition 5.2.4 by Boxfuse
Database: jdbc:h2:file:./foobardb (H2 1.4)
Schema version: 2
+-----------+---------+---------------------+------+---------------------+---------+
| Category | Version | Description | Type | Installed On | State |
+-----------+---------+---------------------+------+---------------------+---------+
| Versioned | 1 | Create person table | SQL | 2019-08-19 12:12:40 | Success |
| Versioned | 2 | Add people | SQL | 2019-08-19 12:12:40 | Success |
+-----------+---------+---------------------+------+---------------------+---------+
Now, here the question is: if I want to update or edit somehing in above two sql files, how can I do that, should I edit existing file version 1, version 2 and
save the file and run all the above command again?
You should not edit your existed scripts. I have to add a new one e.g. V3__Update_person_table.sql and correctly update it.
P.S.
In the big project, we have tens of scripts that iteratively modify the empty database to achieve a current status.
After that, usually, when moving to the next release version, we merge all existed scripts into one or two (when we do not need to keep history anymore).
Notes
This is correct. We do not change existed scripts (this is part of CI/CD). All changes should be added additionally with new scripts. Flyway accepts a directory with all scripts.

Flyway database migration tool info option not printing the version number

WE have flyway integrated with Redshift and we are using this as a simple java main program to run all our schema migrations. We also use the info command to print the current version of the database, However this command successfully runs or at least appears to run but does not print the version number.
We have version 4.2 of the flyway jar. What is that we may be missing? Thanks
To manually recreate what the info command line option does in java code you can copy what its implementation does (from the source):
MigrationInfoDumper.dumpToAsciiTable(flyway.info().all())
An example from the docs is shown below:
+-------------+------------------------+---------------------+---------+
| Version | Description | Installed on | State |
+-------------+------------------------+---------------------+---------+
| 1 | Initial structure | | Pending |
| 1.1 | Populate table | | Pending |
| 1.3 | And his brother | | Pending |
+-------------+------------------------+---------------------+---------+

Wordpress and phpMyAdmin cannot open a RDS database

I created a WordPress multisite on an EC2 using CentOS 7 with MariaDB.
Amazingly it works.
I followed the instructions here
to upload the database
using MySQL from a command line I can attach to and see the RDS database.
MariaDB [(none)]> SHOW databases;
+--------------------+
| Database |
+--------------------+
| WPDB01 |
| information_schema |
| innodb |
| mysql |
| performance_schema |
+--------------------+
MariaDB [(none)]> select User, Host from mysql.user;
+-----------------+-----------+
| User | Host |
+-----------------+-----------+
| WordPressAbuser | % |
| WordPressUser | % |
| rdsadmin | localhost |
+-----------------+-----------+
So I know the ports are open and the database is there.
But changing localhost inside of wp-config.php to mymariadb.xyz.us-east-1.rds.amazonaws.com does not work.
What am I doing wrong?
Check if Your EC2 security group is attached to RDS security group?
check the below image of rds security group
Your RDS should have a new separate security group and in the source, you have to add ec2 security group.
that rds security group should be attached to you rds instance
the ec2 security group should attach to the corresponding ec2 instance
then try to connect

How to restart ceilometer service

I changed pulling intervals in /etc/ceilometer/pipeline.yaml file from 600 to 60 and can't make the service to use new values. I restarted everything that relates to ceilometer in openstack-status command, but that did not work. Can somebody tell me the proper way how to do it?
I am using Openstack Liberty on Ubuntu 14.04 LTS
root#OS1:~# openstack service list
+----------------------------------+------------+---------------+
| ID | Name | Type |
+----------------------------------+------------+---------------+
| 056fcccaad5c4991a8a0da199ed1d737 | cinderv2 | volumev2 |
| 483a0cd1ba79430690a8960ae3d40222 | glance | image |
| 5c704fc9253e4c15895589eb19fab2ac | keystone | identity |
| 92bfcfb417314e80a43e6e7d4d21f99b | nova | compute |
| a7a3809d73674d3da3fbe8030b47055a | horizon | dashboard |
| c21b5e3c9d68417cb11df60d72f9bb58 | heat | orchestration |
| c7030edb082346328a715b00098b974a | neutron | network |
| d331f5360e2b4d3a854e7f47107a9421 | ec2 | ec2 |
| f0a22f827bed43dbbc43822abfc3e3e0 | ceilometer | metering |
+----------------------------------+------------+---------------+
root#OS11:~# openstack-status
.
.
.
== Ceilometer services ==
ceilometer-api: active
ceilometer-agent-central: active
ceilometer-agent-compute: inactive (disabled on boot)
ceilometer-collector: active
ceilometer-alarm-notifier: active
ceilometer-alarm-evaluator: active
ceilometer-agent-notification:active
.
.
.
Well, you need to restart ceilometer-agent-notification service because this service is responsible for transforming the data into samples in the ceilometer database.
Thus, systemctl restart ceilometer-agent-notification.service will help along with restarting other services.
Since ceilometer-agent-compute service is disabled, you just need to restart ceilometer-agent-central service on the node you have modified the config file.
sudo service ceilometer-agent-central restart
You might want to auto reload pipelines after you modify it, for that, you can set refresh_pipeline_cfg=True and a proper time for pipeline_polling_interval such as 120 seconds in /etc/ceilometer/ceilometer.conf.
Note, be careful when you enable auto reload, and only save pipeline config file after you are sure about the content is right (otherwise it might lose 1 polling period data)

Resources