MySQL Federated table crashes MySQL workbench - mysql

I just enabled Federated engine on MySQL 5.5 server. I set up a federated table on another server and made sure I had an IP passthrough setup on the server I'm connecting to on MySQL port. The connection is really slow. In MySQL workbench, initially selecting the table or especially right clicking on the table causes MySQL workbench to lock up and I have to force it to close. If it does finally let me click on it, I get an error when trying to query data:
Error Code: 1429. Unable to connect to foreign data source: Can't connect to MySQL server on 'server IP' (110)
I have another MySQL server where I set up the same Federated table to the same destination server and I have no problems querying data.

I just found out the issue. It was due to MySQL not having the proper permissions. I started getting an "Error Code: 1159 Got timeout reading communication packets" message. Turned out the view I was pulling into the federated table was so huge, that it was causing timeouts. Dumping the view into a cache table and setting it up with a proper index and linking the Federated Table to the cache table solved the problem.

Related

How to make federated tables persistent between restarts on MariaDB?

I'm moving from MySql to MariaDB and I have several databases using federated tables. Everything works fine in the MariaDB but when the server restarts, all federated tables stop working as if the remote server's entry doesn't exists on the local MariaDB server.
After every restart the servers' entries remain in the servers table in the mysql db. If I try to add them again with the CREATE SERVER command, I get an error as if they exist. If I try to drop them with DROP SERVER, I get an error as if they don't exist.
The only way to make it work again is to manually remove the entries from the server table with DELETE FROM servers and create them again with the command CREATE SERVER. How can I make those configurations persistent?
I've searched extensible and couldn't find any solution or mention about this issue. The tables work fine in MySql. The logs doesn't mention anything related to the FederatedX engine between restarts. I'm using MariaDB 10.3.18 on CentOS 7.
I just found that this issue only occurs if the servers table is using the InnoDB engine. Changing it to MyISAM or Aria solves the problem.
For some reason my server was installed with the wrong engine for this table.
Edit: bug report here.

All Schema Columns were Removed After Removing MySql Instance

My MySql service was running as MySql2. Today, I liked to change the name to MySql. I started MySql Server Instance Config Wizard and selected the option Remove Instance. I then created a new instance with the name MySql from the same wizard.
I ran MySql Workbench and found that all my databases have no columns and when I try to select a table, an error message says:
09:16:34 SELECT * FROM ut_db.agency_info LIMIT 0, 1000 Error Code: 1146. Table 'ut_db.agency_info' doesn't exist 0.000 sec
I have no idea why this has happened. Does removing the instance remove databases? And if so, why are all the names of the tables are listed in MySql Workbenches navigator?
I figured out that I chose the wrong InnoDB TableSpace path in the wizard. So choosing the path as it was before removing the instance has solved the issue.
Even though, I am not really sure why all table names of my databases are correctly listed in workbench navigator even that InnoDB TableSpace path is wrong!

MySQL - Does Federated Engine have to be enabled on both servers?

I am attempting to run a single MySQL query, joining two databases on two servers.
I am aware of the potential poor performance, but would like to test regardless.
The purpose of this test, I am working on a Windows domain, with a development (local) server and a live (remote) server.
The local server has FEDERATED engine enabled and the remote server, which stores the actual data but FEDERATED engine is disabled.
Both tables (live and federated) have the same definition/schema, and the federated table on the local server has been defined:
ENGINE=FEDERATED
DEFAULT CHARSET=utf8
CONNECTION='mysql://remote_user#remote_server/remote_database/remote_table';
The local server table creates fine, and although the remote_user and remote_user#'MY-PC-NAME' has the correct GRANTS, I am getting an error:
ERROR 1429 (HY000): Unable to connect to foreign data source: Access denied for user 'remote_user'#'MY-PC-NAME' (using password
My question is do both the local and remote servers require the FEDERATED engine to be enabled?
If not, is there anything else I need to do to get the federated table
to work?
FEDERATED engine option is not required to be enabled on both servers, in this case, only the local server where the federated table is stored, requires to be enabled.
It turns out that the remote_user user requires the PASSWORD option.
I used this to get the connection to work:
CONNECTION='mysql://remote_user:password#remote_server/remote_database/remote_table';

mySQL workbench hangs after connecting to database

I am using MySQL workbench 6.3 CE to connect to mysql database on amazon aws (rds) system. I was running a create table query that was taking too long (lot of joins), and I stopped the query, and closed the workbench from Task Manager (end process). Since that operation:
1) I can open the workbench connect to the database, but once I connect and select any table from the schema, the workbench hangs.
2) No query could be run from workbench - I have to stop the query and I get the error "Interrupt: Error 2006, Mysql server has gone away".
3) if I click on the table name in the object browser, I don't see any columns for the table.
I tried to run the queries from the command line (in the workbench, right click on the database connection and click "Start command line client" - and here, I am able to run queries without issue. However, I have connected to this database through RODBC - in R, none of the odbcCommands are working (sqlTables() hangs, etc).
I am at my wits end trying to understand whats wrong - any pointers would be wonderful.
Thanks.
Actually, I realized it was because I stopped the create table query - I don't know the mechanics, but apparently, there was a background process running. I had to kill the query and kill the connection and everything was back to normal.
Hope this helps someone some other time.

MySQL can't connect - ERROR 2002 (HY000). Please HELP!

I was using mysql, trying to add some foreign keys to a database on a Debian server... and all of a sudden I started getting this message:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (111)
No matter what I do, I get this message. If I restart mysql, it just spits this crap out a bunch of times.
I have rebooted the server a bunch of times, and it's not going away. I have no idea what I did... I was just changing the schema of a database that has actually been in production for over a year.
I recently changed the domain name of this server, but mysql was working for a few days after this change.
Beyond that, I can't think of anything I did differently.
Please help. I have to get this database back online.
EDIT: Joy, mysql corrupted my actual database by trying to add foreign keys into a freaking database. The database is toast.
Good thing I have backups, but this is unreal.
This seems to be a useful link. It suggests starting mysql daemon, then type mysql.
/etc/init.d/mysqld start
mysql
If that does not work check the config files for both your mysql client and server to make sure they are pointing to the correct locations.
It turns out that the database was corrupted. If you're also getting an error like this that defies reason, try showing tables and selecting data out of your basic default databases that comes with mysql just to be sure.
In my case, dropping and adding foreign keys actually destroyed my database, which explains why rebooting the server or restarting mysqld was having no effect.