I have a Joomla database that was dumped into a .txt file on an appache server using the command:-
mysqldump -u admin --opt -p passwd > private/alexthekiddb.txt
How do import that into a new MySQL database on my IIS server so I can attempt a conversion from Joomla to Wordpress.
I can use phpmyadmin or the MySQL builtin command line tool.
I already have a 2nd new database created with the same name and user (and PW) as the original.
Normally, just running mysql private/alexthekiddb.txt or mysql < private/alexthekiddb.txt should be enough. Hence, such dump files are usually suffixed .sql
Of course, you should have a MySQL server on the target machine (IIS thing).
Related
I exported (dumped) a .sql file from my remote Linux server and would like to import it to my local MYSQL server (windows 10) using bash command in git bash.
mysql -u root -p DBname < C:/Users/.../sb_backup.sql
after this command it asks me for my MYSQL client password and then it freezes forever. When I ctr+C and go back and check, I see it has not been imported yet.
I already created DBname and it exists.
I appreciate your help.
In order to load databases to mysql using terminal, as shown here, the sql file must be already in the server? Or I can upload from my local pc?
If you have mysql installed in your local machine: then you can at once run the import command from local machine's command line
mysql -hmy_server -umy_user -p database_name < full/path/to/file.sql
or you can just go to the directory where your sql file exists and run
mysql -hmy_server -umy_user -p database_name < file.sql
(password will be required after hitting Enter). This way the file will be imported into the remote database from your local computer.
No mysql is installed in your local machine: in this case you have to manually upload the file into the server with some ftp client and then connect remotely(e.g. by Putty) and run similar command
mysql -umy_user -p database_name < path/to/sql/file.sql
Yes. You can SCP or SFTP it to the server, but that command expects a file on the machine. In fact, that particular command expects it to be in the same directory that you are in.
Assuming the file contains SQL statements it can go anywhere. What is important is that the MySQL client you use to read the file can access the database server - usually on port 3306 for MySQL.
On the server, unless your local directory is accessible via network to the server (i.e. network share on another machine which is mapped to some address on your server - convoluted but essentially possible).
Basically, just upload the file to the server and run the command locally there.
NO, the SQL file or SQL script file generally can be present in your machine. When you execute the command, said sql script gets executed against the database.
mysql -u user -p -h servername DB < [Full Path]/test.sql
i have a .sql file that was exported from wamp, my friend only uses xampp. Is it possible to import my .sql file to xampp?
Yes because the .sql file is most likely independent of the server stack.
Of course it is possible, when wamp give you a export of .sql, this file can be used with all standard web server. (xampp)
I think this may help
Depending on the tool and parameters used to create the .sql dump file of multiple databases, the file will normally have
CREATE DATABASE DBn...;
and
USE DBn;
statements that will allow your import to proceed without hiccups. For example, both the mysqldump command mysqldump command and phpMyAdmin's Export function for multiple database insert them.
Assuming you have exported with a sensible tool like those above, then you can import the database with a command line like this:
mysql -u username -p < dumpfile.sql
Your mysql username account needs to have appropriate privileges to, for example, create databases.
You can even run this command in a more familiar way by naming the startingDB database to use before running the commands in dumpfile.sql:
mysql -u username -p startingDB < dumpfile.sql
Let's say I remote from my workbrench to the database which is on server now for some reason I need to have copy of the database on my another computer as a local database. How can I do that?
Export it to a single file (whatever.sql), then import it by running the script on your local computer.
There's a "Data Export" link on the left side if you connect to the remote server using MySQL Workbench. Click on that and go through the export process. Then connect to your local server, click on "Data Import/Restore", and choose the file you just saved.
First export data from database, then import database or specific table import in local server.
$ mysqldump -u [uname] -p[pass] [dbname] > [backupfile.sql]
To dump all MySQL databases on the system, use the --all-databases shortcut:
$ mysqldump -u root -p --all-databases > [backupfile.sql]
Source :How to Copy (Backup) a MySQL Database
In addition to a dump and restore you can try the MySQL Workbench migration module which allows to migrate from MySQL to MySQL (useful for instance to upgrade from a previous version or to copy a schema, as in your case).
MySQL Workbench migration (general description, video tutorial, white paper): http://www.mysql.com/products/workbench/migrate/
The MySQL Workbench migration wizard: http://dev.mysql.com/doc/workbench/en/wb-migration-wizard.html
I am working in a project heavily involving WAMP. The complete size of all the databases on the Mysql server in WAMP is around 150 mb. How do I transfer this between computers ? There seems to be a limit on the size of the file. Altering PHP MyAdmin doesn't seem to help.
Also, I usually import databases individually by creating a database with the same name and then selecting the database file to be imported. However, I have now exported all the databases collectively and it gave me a file called localhost.sql (With 8 databases in it)
How do I import this in a Mysql server in another computer?
Don't use PHPMyAdmin. Instead use mysqldump utility to create a dump file:
mysqldump --user=root --all-databases > dump.sql
This will create a dump.sql with all databases on your server. For information on how to select individual databases/tables see the the documentation
Then on another computer load the dump into mysql
mysql --user=root < dump.sql