How can I see all the relations betwen tables in phpmyadimn - php

I have a db that has around 280 tables, is there a way in phpmyadmin to see all the relations between all the tables? I need to export some data an I need to export 1st the tables that have no dependencies and after the ones that depend on them.

Go to your Phpmyadmin Select database you can see more link in that window from the dropdown select designer

Related

Inner joining 2 columns from different tables in MYSQL workbench

Sorry, but I'm quite newbie in SQL and PHP. Previously, I was able to easily join 2 tables columns in PHPmyadmin with the design button with out any PHP. However, I'm trying to retrieve my database with python, so I have to MYSQL workbench.
I'm trying join 2 columns on seperate tables, but I can't get it to work. Firstly, I've watched several tutorials and I really can't understand PHP and all the scripting. Secondly, I tried joining the 2 tables when in reverse engineer since it seems quite similar to PHPmyadmin, however I cannot select individual columns while in reverse engineer, even if I try to index the columns.
IMAGE
I'm trying to join or make class1, class2, class3 from student table equal to classid from the class table. Is it possible at all to join the 2 tables here so it would actually show a linking between 2 specific columns? I can easily add a line but it always selects the primary key.
I appreciate any help, thanks. Alternatively, if I could get help in developing a PHP script, which also shows the linking between 2 tables, that'd also be great.

Export MySQL column aliases in phpMyadmin

I am currently moving from one ticketing system to another. The table columns are close but not quite. I can run a query that will change the column name to what I need. However, when I export I am getting the original column name.
Here is the query with alias:
SELECT u.id AS staff_id
FROM users AS u
This gives me what I need. However when I export it, it is showing the original column names. Is there a way to keep the alias when exporting?
Since you're using phpMyAdmin, you can quickly use the "Rename exported databases/tables/columns" feature to rename your table and/or columns when exporting. (I believe this feature was added with version 4.6.0).
On the export page, select the "Custom - display all possible options" radio button, then in the "Output" area look for the "Rename exported databases/tables/columns" checkbox, which opens an additional dialog where you can adjust these names.

MySQL- insert one table into another table in a different database

I've got a production(prod.products) and a development(dev.products) database. I now need to insert the table ('prod.batch-numbers') from the production database into the ('dev.batch-numbers') table within the development database as this one is not up to date. Both tables have the same layout. Any suggestions on how to do this? Quite new to MySQL so any help is appreciated!
Try this:
INSERT INTO `dev`.`batch-numbersz` SELECT * FROM `prod`.`batch-numbers`;
Note: for this to work, you'll need to run the query from a user with proper rights on both databases.
Or simpler if you only need it done once: do an export of the production table and import it in the development database.
Most database tools support both export of tables and import of files.

What does Add DROP SYNTAX in X-Cloner of Wordpress mean?

What does "Add DROP SYNTAX" in the XCloner plugin mean?
I checked the manual and it says something I don't understand.
Add MySQL Drop:
Tick this checkbox if you want XCloner to add the DROP TABLE IF
EXISTS statement to your generated SQL. This option is only for
advanced users.
How important is this to check? and will I lose anything if I ignore it? Please explain in both short and long answers.
Thank you.
If you enable this option, the resulting exported SQL will contain DROP TABLE IF EXIST statements. This means that when you try and import said SQL into another database, it will DROP any existing tables that have the same names as the tables contained in the SQL. If I export the tables users, items and news from Database A and I attempt to import them into Database B, any tables with those names will be dropped before those three tables are imported. So, if I already have a table called users in Database B, it will be dropped before the "new" users table is imported. Could be disastrous if you have another app connected to Database B that also uses its own table called users.

How can I compare a mysql table between two databases and update the differences efficiently?

Here is the setup, I have multiple online stores that I would like to use the same product database. Currently they are all separate, so updating anything requires going through and copying products over, it is a giant pain. What I would like to do is create a master product database that every night, each site will compare its database with, and make updates accordingly.
The idea is one master database of products that will be updated a few times a day, and then say at 2:00 AM, a cron job will run pulling the updates to the individual websites.
Just a few more details on the database, there is one table 'products' that needs to be compared, but it also needs to look at table 'prodcuts_site_status' to determine the value for the products status for each given site, so I can't simply dump the master table and re-important it into the site databases.
Creating a php script to go row by row and compare and update would be easy enough, but I was hoping there existed a more elegant/efficient solution in mysql. Any suggestions?
Thanks!
To sum up you could try 3 different methods:
use SELECT ... INTO OUTFILE and then LOAD DATA INFILE from MySQL Cross Server Select Query
use the replication approach described here Perl: How to copy/mirror remote MYSQL table(s) to another database? Possibly different structure too?
use a FEDERATED storage engine to join tables from different servers http://dev.mysql.com/doc/refman/5.0/en/federated-storage-engine.html

Categories