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
Related
I'm trying to import existing database file into an empty SQL database with the following command:
mysql -u username -p'password' db_name < dbfile.sql
but I get following Error:
ERROR 1146 (42S02) at line 1: Table 'db_name.oc_address' doesn't exist
I know that oc_address is a table name inside the SQL file, but I don't know what to do to import it correctly, I searched the web and also stack-overflow, found nothing on this error.
Download the actual opencart zip file
https://www.opencart.com/index.php?route=cms/download/download&download_id=62
Unzip it
open folder
\upload\install
and
run opencart.sql
if you have installed extensions that have need their own sql, you have to run their sql as well
After that run you backup file
To export an entire database and then load it into another server, your best bet is to use the mysqldump command line utility. Its export files contain the data definition language (tables, views, all that) for the database as well as the data.
You can also get it to export just the definitions.
mysqldump --no-data -u username -p'password' db_name > opencartddl.sql
Then you can import that file first, then your data file.
Or, you may be able to stand up a new, empty, Opencart instance and use its UI to import your data.
It's probably wise to avoid trying to write replacement DDL yourself if you can get a tool like mysqldump to do it.
I have a sql file containing data that I want to import to a table on MySQL.
I know the dead easy way is to use a a management software like MySQL work bench and import it that way but I want to learn how to it by command line
I already have sftp the file to the root directly on my linux system but im unsure how to import the data from the .sql file to the table I have in my database.
Use the file as input to the mysql command from the shell command prompt.
$ mysql -h servername -u username -p databasename < filename.sql
You will then be prompted for your password.
If you're already inside the mysql program, you can use its source command.
mysql> source filename.sql
I want to import a 600mb .sql file into phpMyAdmin. As I have memory limitation in server, I can't use import option given in phpMyAdmin.
mysql -u username –-password=password database_name < file.sql
If it's not clear, look for how to load from a dump file.
mysql -u [username] -p [dbname] < [path for the sql file to be imported]
You can use this in mysql command prompt.
PHPMyAdmin Can only do this if the server settings are sufficiently generous to allow you to upload such a large file.
If you have command line client then you should use the mysql client. If you don't have command line access then MySQLDumper is a very good tool for importing large SQL files.
If you have memory limitations in the server and you are using phpmyadmin, you have to manually split the sql file or use a tool to split the file based on your memory restrictions and import file by file.
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
I want to import an sqldump file in my database "dbname" into the table "data" without using the network interface.
when i import the file via
mysql dbname -u databaseuser -pdatabasepass<data.sql
this is really slow on my ubuntu 12.04
but when i use this instead:
mysqlimport -u databaseuser -pdatabasepass --local data.sql
it is as fast as normal.
i think, because on my mashine it is parsing each line separately when using "mysql" and "<"
is there a way to use the mysqlimport syntax for importing an sql-file with CREATE and DROP TABLE stuff?
maybe just split the upper part in the sql-dump (with the drop table and create table statement) automatically and then only send the rest of the file with the INPUT-statements to mysqlinsert, that should work
There is no way to do that directly. What you need to do is run mysqldump --tab instead of the normal mysqldump, that will create both a .sql files containing table definitions and a CSV file containing data that can be imported with mysqlimport.
You can specify the path to a UNIX socket file with --socket=/path/to/... (or -S), which may be faster. You can find the socket path in the server's my.cnf. So, for example (and I'm just making up the path, here);
mysql dbname -u databaseuser -pdatabasepass -S /var/run/mysqld/mysqld.sock < data.sql
You can use this script: How do I split the output from mysqldump into smaller files?
and modify it, so you have only the create-statements in one file and the data statements in another.