MySQL / PHPMyAdmin - php

I've recently taken over a WordPress site from another 'dev' company. The site is highly unstable and not delivering what the client needs. So, I'm currently trying to export the site wholesale to one of our company server.
Numerous backup plugins have failed for various reasons, so I'm now trying to get an export of the MySQL database via phpmyadmin to import into our MySQL server. I've taken a full export from the old server and tried importing it into the new server via phpmyadmin . However, this fails after a period of time, with no real indicator of why.
Next, I exported every table individually and tried to import them to the new server. The first 2/3 or so appear to work but then the latter 1/3 all fail to import with the output/error message saying that the table has multiple primary keys declared.
I really need to export the database structure and data from the old server and transfer it to the new one. So, I'm really perplexed as to what my next move could be. If these tables have multiple primary keys and this prevents an import, how were they created in the first place??
What can I do to remedy the situation and get the data migrated?

This could be a problem of the dump you get. If it was too big, your phpmyadmin would just break down after a while. If you have ssh access to your server you could easily import your dump by shell after uploading your dump file to your server. If this is not possible you could maybe work with a big dump script http://www.ozerov.de/bigdump/ which automatically imports the dump partially, so there is no server timeout anymore.

It appears that this was related to some limiting factor with PHP / phpMyAdmin. I was able to import the generated SQL scripts via the SQL tool in Virtualmin / Webmin without any apparent issue.

Related

How to easy configure Hadoop for big MySQL table

I'm doing my student work. Please help me understand in what direction should I move.
So, I have a big MySQL database (31.3Gb, 130 millions rows) on my PC. I have written a simple html page (interface for my program). I'm using PHP for connecting to my database, AJAX for retrieve data from a server asynchronously and OpenServer (local server for testing).
How it works: the user selects some filters on my html page, clicks the search button, and it displays the main table.
Everything works well, but what should I use to connect my project to Hadoop? It is a mandatory requirement.
Maybe HortonWorks/Cloudera/Docker?
It will be very useful if you send links on some useful guides.
The main criterion is simple to configure and install. Also, I have only 4Gb of RAM on my laptop, so most likely I have to use old versions of tools. HortonWorks 2.1 was successfully installed even on my virtual machine (Ubuntu 14.04)
In advance thank you everyone for your help!
You can use Sqoop import to push data from MySQL to Hive.
Then, you can query via HiveServer2.
For getting Hadoop and other components, it is best to use HDP or CDH sandbox. If your machine resources do not permit using the sandbox, consider using AWS.
Once you have data in Hive, you can point your application to query Hive and serve results, instead of going to MySQL.

MySQL in XAMPP stops unexpectedly whenever an activity is created in MOODLE

First of all we created a moodle site on our local machine. Afterwards we integrated our work using TFS (Team Foundation Server). Now we changed the ibdata1 file in our database which includes the change of all people and took the latest version of the site from TFS. But now whenever any activity or resource is being created in MOODLE site, mysql stops unexpectedly and says DATABASE READ AND WRITE ERROR; while login takes place effectively and reads the username and password from database. The error message shows that your database must be corrupted or you may not have the priveleges or block port or shutdown by another method. While log shows database "you have moved .frm files to another database?
or, the table contains indexes that this version of the engine
doesn't support." and sometimes "The InnoDB memory heap is disabled". Please help.
Have you copied the database frm files rather than doing a data dump? This won't work. You need to do a database dump and restore.
On the original server either use phpmyadmin or mysqldump. Phpmyadmin should be already installed by xammp
If the server is your local machine, you can access phpmyadmin via
http://localhost/phpmyadmin
Then go to database name, click the export tab and click go. This will download an sql file.
Then on the destination server, do the reverse. Go to phpmyadmim, you will need to create a blank database, then click the import tab and select the sql file.
Also copy the moodle data folder, this is a straight forward copy.
http://docs.moodle.org/26/en/Moodle_migration
Don't try to merge 3 databases, the id's will be out of sync and the data will be completely useless.
If the code from the other developers has been written correctly, they will have install.xml files and possibly upgrade.php or install.php files to make any structure changes to the database.
http://docs.moodle.org/dev/Upgrade_API

How to Synchronize mysql databases between local and hosted servers automatically?

I would like to synchronize local Mysql db with remote Mysql db.
Due to internet fail, we have to use local application. Once internet problem solved, db should synchronize with remote db.
Because we are using same application in local and remote.
You can use SQLyog which has Database synchronization feature to sync two databases if you are looking for open source tool then refer pt-table-sync http://www.percona.com/doc/percona-toolkit/2.1/pt-table-sync.html
You can make the dump of your local database, and import that on the hosted server when ready.
I think I would create a table changes on a local database and whenever I do any change on the database, it is also saved in the changes table.
For synching then, I'd
loop through changes table and make query-like string
copy it to a clipboard
Have a page on a hosted web with input where to paste that string
When submitted, PHP explodes the string into different queries
Loop through queries and perform them against a hosted database
Of course, here intensive validation should be considered to ensure that the pasted text is a query string copied from the local server
I am afraid you need to do the export and import thing. Don't think there is any automatic kind out there..erm, i would like to know as well

Porting stored procedures between MySQL servers

I have inherited a web-application project (PHP/MySQL) which makes extensive use of stored procedures, and I am unsure how to transfer these to my local machine for development.
Specifically, it is the exporting and importing of these stored procedures that I am facing difficulty with (with the ultimate aim of being able to automate installation of a "base" version of the application database, complete with stored procedures).
I shall state the bits and pieces that I believe I understand:
I can export the information_schema.ROUTINES table, but cannot import it (phpMyAdmin) onto my local server (I believe that information_schema is a system database?)
As I do not have shell/command-line access to the "online" MySQL servers, tools such as mysqldump are only of very limited use (to port to my local testing machine, but not vice versa)
The command SHOW CREATE PROCEDURE procedure_name; is supposed to output SQL that can be used to create the procedure, but I can't seem to get this functioning correctly (ERROR 1305 (42000): PROCEDURE delAddress does not exist)
Assuming that the the above works, the next step is to have it be looped to export all stored procedures (..and then be run via phpMyAdmin elsewhere, to import it)
Please correct anything that is incorrect, and provide guidance on how to automate porting between database servers.
Many thanks
Turns out the solution was ridiculously simple.
On the export page, there is an Add CREATE PROCEDURE / FUNCTION / EVENT statement option.
By checking this box, it also exports the SQL necessary to import procedures at a later date/on another server.
Use MySQL Workbench's migration feature. The whole thing is free and it does an amazing job.

How to Import Local MySQL Database to Web Server

I have a database with two tables in it, and I have exported them into a "dump.sql" file in my computer.
I am using a free web hosting service (000webhost.com) and I have a database named "username_newdb" and I want the two tables to be imported in that database.
I tried "Import" from phpmyadmin page, but it gives the error access denied for user, I don't know why. Moreover, I prefer to import the tables into new database, not to import (and create) the whole database. Can I do this? Maybe with PHP code?
If not, creating a new database would be accepted, too.
Any help would be appreciated.
if you can connect to that database from your computer directly, you can use any mysql manager to do the import, assuming your login/password is right as backup sql is just text file with bunch of INSERTs and CREATE TABLEs (so basically phpmyadmin should not even complain).

Categories