mySQL tables get dropped un-intentionally - mysql

In a development environment, where Ubuntu 14.04 installed and updated to Kubuntu 14.04 is used the operating system. MySQL installed and used with Netbeans and JPA using eclipselink. I noted that some tables are dropped without my knowledge and then I created users with no drop or delete privileges. When I log with mysql command, I can not delete tables. But tables are still get dropped intermittently ? What can be the cause? I am really worried as a very similar environment is used in production and a loss of a table can lead severe consequences.

Table just don't magically disappear.
If I was you, I'd start by getting the list of users having the rights to do the delete/drop table.
Ask them if anyone is working on the DDL.
If no one seems to be "guilty", then what about to check what logging possibilities are provided by your DBMS, and to what extent could you log drop operations.

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.

Connecting my MySQL databases to phpMyAdmin

I am running Mac OS 10.10.2. I have recently been educating myself about php and SQL in order to create an online database application for my employer. However, I have been unable to load up my MySQL databases in phpMyAdmin. I have tried following some advice from this forum, but no answers seem to solve my issue.
I installed MySQLWorkbench (Ver. 6.2.4.12437) as well as XAMPP (Ver. 5.6.3-0), and was using phpMyAdmin to have a play around and better understand what I was getting myself into. I then found one of those follow-the-bouncing-ball type teaching websites which advised me to download and install the MySQL community server (Currently running Ver. 5.6.23)
As instructed, I was learning SQL commands through Terminal and built up some databases/tables this way. I decided I wanted to jump into phpMyAdmin where I felt it'd be easier to continue my work. At first XAMPP was unable to turn on the servers which I overcame by uninstalling and reinstalling. Then I was getting a #2002 error when trying to access phpMyAdmin. I tinkered with config files and put in details relating to my localhost MySQL server (Or at least I assume as much).
I was able to get back into phpMyAdmin finally, but my databases made through terminal are not there.
phpMyAdmin shows: cdcol (the example database), information_schema, mysql, performance_schema, phpmyadmin, and test.
If I open terminal and punch in 'mysql' then 'SHOW DATABASES;' it only lists: information_schema.
If I open terminal and punch in 'mysql' with username 'root' and my password, then 'SHOW DATABASES;' it lists: information_schema, mysql, performance_schema, my tutorial/learning database, and my business database. I dropped the test database from here. THESE are what I want to bring up in phpMyAdmin.
I can only guess that I haven't got it configured properly to access this last mysql server, but I can't determine where I am going wrong. If anyone can shed some light on this, that'd be greatly appreciated.
It appears as if you have two MySQL instances; one from the XAMPP and also the MySQL Community Server that you installed yourself.
The "M" of XAMPP is for MySQL, so yes usually it runs its own MySQL server instance. That's sort of the point of the packaged kit, so you don't have to worry about having any of your own applications installed. In theory it should be no problem to stop the XAMPP MySQL instance and instead use your other one, but may require tweaking some configuration files and is probably not supported. If you can make it work, I don't see a reason why it would be a problem, though.
My suggestion is to either use the complete XAMPP stack or roll your own installation rather than mix and match.

MySQL table crashes only after repair

I am using WordPress with MySQL. My site recently crashed (due to some out-of-memory problem with the database)
Once the site was up, it seemed fine, but just in case I ran "repair" (from phpmyadmin) on the DB. After that, it crashed my "wp_posts" table. I restored the DB from an older version, again - the table seemed fine. Again, I ran the "repair" and the same table crashed.
I am on a VPS server. So I don't have root access, but I can ask the web admins to check things.
Any idea what might be causing this / how to solve it?
Thanks.
This is a MySQL server configuration problem. I've had the same problem. In my case it was due to a MySQL system variable called myisam_sort_buffer_size being set to an absurdly small value (4096). This interfered with the repair table operation. In my case, the wp_posts file and others used the MyISAM access method. If yours use InnoDB, you'll want to look at the variables controlling that access method rather than MyISAM.
Issue this command to your MySQL server:
show variables like '%buffer_size'
Then look for variables which seem low.
You may also want to look at the MySQL server error log file.
If you run the server yourself, please be careful making configuration changes: Read the doc page first. http://dev.mysql.com/doc/refman/5.6/en/server-system-variables.html
If your hosting provider runs the server, put in a request ticket, ask that it be escalated to a support person who knows about MySQL, and be specific about what is going wrong.

phpMyAdmin crashing the MySQL host server

I have encountered this problem a couple of times, in the last few days. So, it happens occasionally. I have setup mysql on a remote machine, and there is a java program on another machine querying the database to read and write records every few seconds.
I am using phpMyAdmin to administer my database. And, at times, after running some SQL query, the mysql server stops responding. Even the pinging the host machine doesn't succeed. And, I have to ask someone with physical access to the machine to boot it up again.
I checked for log files but couldn't find them in the mysql directory. Is logging disabled by default? What is missing here? And, how can I go about troubleshooting this?
EDIT:
I was able to ping the server after some while. So, the server must have been temporarily busy. It's not a specific query but things like re-ordering the data of a table serially under the browse tab.
Use a mysqlclient to make a connection and keep it open.
I personally use the mysql from the commandline.
If the server becomes unresponsive execute
SHOW PROCESSLIST;
It will list all mysql processes and will show how long queries are waiting/executing.
Optionally use the KILL statement to terminate the query that locking the tables.
KILL $pid
I'd highly recommend using MySQL's own GUI tools for database management, for a vriety of reasons:
They have full support for InnoDB tables, including Foreign Key management
You can use database-level security to make sure only you get into your data (unlike phpMyAdmin, which at best can only be root access installed behind a .htaccess password)
It is official and supported. No extra binaries run on the server, so you run no risk of it crashing and taking the server down with it (unless your query itself is locking it...)

How do I upgrade mysql?

When upgrading MySQL, I first create a backup of the database. Then I will uninstall the current version installed, and delete all the files that were left by the installer. Then I install the latest GA version, and restore the created back-up, using the MySQL Administrator.
Is there a better way of doing an upgrade of the MySQL. Because I have to create again all the users that are allowed to connect to the database.
The installation of the MySQL is used in a college enrollment system, a client server system I have developed using VB.Net and MySQL. I can only do the update at night because i know no one is connected to the database.
you can dump the mysql.user and mysql.db tables, which contains all the user info, and reimport that as well, to avoid having to recreate all that. i'd also suggest running repairs on the table after you re-import.
alternatively, you could create a listing of grants:
select concat('show grants for ',quote(user),'#',quote(host),';') from mysql.user
this will output a list of sql statements that you can then run to get specific grant statements.
ultimately though, you'll want to check out your specific version information regarding upgrades, to make sure you've considered any version specific compatibility issues.
here is some information for a 4.1 - 5.x upgrade, for example.
Why is the mysql upgrade so braindead? The fact that you need to back up all your data, install MySQL to a different directory, reimport your data -- just to upgrade is ridiculous. There has to be an easier way.