I have 6 tables already created, which I access from mySQL Workbench. Is there any way I can get the query for the creation of the database and all 6 tables inside it? I need this so that I can create that database and all 6 tables on it, on another computer simply by double clicking an sql file. Thanks in advance :)
If you want to get SQL File from MYSQL Workbench, you need to do this :
Open your model.
Click Database menu and choose Forward Engineer.
And click next until you show like picture below,
Save to file..
Related
I am working on a database from two different computer, one person inserts data to the tables from one pc and another person from another. At the end of the day we want to add all the data inserted from 2nd pc to the 1st one. How can I achieve that?
I have tried exporting the database from 2nd pc and importing it on 1st pc but it doesn't work.
you said that you have tried to export the Database. I think that this is the thing to do. Export the Database as (SQL File) and import it on the other.
the steps to export your Database is:
go to your database location. For phpmyadmin its: localhost/phpmyadmin
navigate to your Database and select in the top Export.
make sure your Format is SQL!
to import it go to import and upload your file.
I'm using PHPMyAdmin but can use MySQL if it's easier that way, I have quite a large database I'm using for a project that will be updated by uploading .csv files.
However this CSV file will add duplicate data every time, which is no good.
I'm looking to delete all content on the table, but keep the structure and column titles.
Whats the easiest way to do this?
TRUNCATE [TABLE] tbl_name
Go through TRUNCATE TABLE Syntax
Here are the steps :
1.) Go to phpmyadmin
2.) Select db
3.) choose Operations tab.
4.) look for "copy database to" panel
5.) give new database name
6.) select Structure only radio button
7.) select CREATE DATABASE before copying
8.) hit Go button
This will create new database with schema only, which you can rename to your original table name later.
The server I'm using does not allow me to use LOAD DATA INFILE or even save a file as a .txt file. I have a .csv file that is just one column, with a name in each row. I want to insert this data into the name column of a table named people with name as one column and location as the other… where the locations will be updated at a later time.
It's a weird way to do this. But I need to do it this way and not using those previous commands.
Does anybody have any ideas? This has been giving me a problem for many hours. I can't figure out how to load the csv into my table column without using those previously mentioned methods that I can't use on my server.
Based on your issue and lack of general permissions you will have to do the following:
Replace the DOS carriage returns with unix new lines:
$contents=preg_replace('/(\r\n|\r|\n)/s',"\n",$contents);
Save the contents to the file, and then loop through each line, building an INSERT command that you execute to MySQL.
This question already has answers here:
Export and Import all MySQL databases at one time
(13 answers)
Closed 9 years ago.
I have created a MySQL database for a website in xampp. Today got my new server which is running Ubuntu. Everything is installed and working fine.
I want to move database which I created in xampp and move it to my server; can someone tell me how to do this? The database is created with phpMyAdmin.
Best regards!
Emil
Export data in PHPMYADMIN
1) Log in to the phpMyAdmin instance on the source server.
2) Click the Export tab
3) From the database drop-down (left navigation), select the database.
4) Choose between a Quick or a Custom export. The Quick method should work most of the time, though if you need to get more granular with your export options, click Custom If you choose Custom, you can configure the following:
a) Tables: Choose which tables to export.
b) Output: Choose the template, character set, and compression for the export.
c) Format: Choose to display comments, enclose the export in a transaction, disable foreign key checks, dump table (structure, data, or both).
d) Object creation options: Add statements.
5) Data dump options: Use INSERT DELAYED or INSERT IGNORE statements, select the function to use when dumping data, select the syntax to use when inserting data, maximal length of created query.
6) Select the format from the Format drop-down (select SQL).
7) Click the Go button.
8) Save the file (which, by default, should be named db.sql).
Import data in PHPMYADMIN
1) Log in to phpMyAdmin.
2) Create an empty database from the Databases tab
3) Click the Import tab.
4) Click the Browse button.
5) Locate the file to be imported.
6) Click Open or OK, depending on your browser.
7) Select the proper collation from the drop-down.
8) Select the format of the import file.
9) Click Go.
Reference taken from : Phpmyadmin Export Import
I would like to create a dynamic drop down menu in excel. I am using two sheets, sheet1 having the drop down menus and sheet2 having the reference data. I already did what other excel tutorials said by using a named range and INDIRECT to create a dynamic drop down, but, this is manually done. My data at sheet2 will be coming from mySQL database so the data will vary from time to time and the named reference will be inconsistent. Is it possible to automate this? Can I create a dynamic drop down? By the way, I am using PHP as my server side script which I use to populate my sheet2 with data.
Thanks!
In excel go to the data tab select from other sources: select the connection you want to use. in the properties window, define the table or query which will provide the source data for the dropdown. have the data "refresh" when the sheet opens. The only issue will be saving the password/userid to connect to the dtabase as it is in clear text and anyone can access.