Mysql load dump file command line




















First, log in to MySQL as root or another user with sufficient privileges to create new databases:. This command will bring you into the MySQL shell prompt.

Next, create a new database with the following command. From the normal command line, you can import the dump file with the following command:. If any errors occur during the process, mysql will print them to the terminal instead.

To check if the import was successful, log in to the MySQL shell and inspect the data. You then imported that data dump into a new database. You can learn more about from the official mysqldump documentation page. I like making impossible things possible. And I need tea. Where would you like to share this to? Twitter Reddit Hacker News Facebook.

Share link Tutorial share link. Sign Up. DigitalOcean home. Paresh Behede Paresh Behede 5, 1 1 gold badge 15 15 silver badges 13 13 bronze badges. Is there a way to do that in a single command line on the mysql command used for import? I agree that this is the best answer. It's not always necessary to turn off autocommit.

Manoj Kumar Manoj Kumar 4, 1 1 gold badge 22 22 silver badges 28 28 bronze badges. But still very slow? PeterMortensen - will depend upon the size of data, else normally it is fast. Easiest way to import into your schema: Login to mysql and issue below mention commands. Ammad Ammad 3, 7 7 gold badges 31 31 silver badges 52 52 bronze badges.

This will work without the 'use' command for dumps with multilpe db in it — Hayden Thring. I was trying to import a dump from a database with a different name but with the same structure, the right answer picked by the author didn't work, it created a new database named after the database in the dump file.

This answer right here did what I wanted, thanks man — Wuelber Castillo. But this is not from the command line in the spirit of the question. It is using the MySQL shell interactively. Amrit Dhungana Amrit Dhungana 4, 5 5 gold badges 28 28 silver badges 35 35 bronze badges. There shouldn't be a space between -p and password — Ejaz. This would not work. Not specifying the password as part of the command will prompt you for password which you can enter securely — asgs.

Especially because of. Show 2 more comments. Kasun Siyambalapitiya Kasun Siyambalapitiya 3, 7 7 gold badges 31 31 silver badges 53 53 bronze badges. Create a database in MySQL. Use that particular database where you want to import the SQL file. Type source databasefilename.

Shiks Shiks 5 5 silver badges 6 6 bronze badges. Thanks — klewis. Little slow but does not stop in between and don't say that MySQL server has gone away. To dump a database into an SQL file use the following command.

Adeleke Akinade Adeleke Akinade 5 5 silver badges 13 13 bronze badges. Tanmay Patel Tanmay Patel 1, 16 16 silver badges 26 26 bronze badges. I think it would be more helpful for the OP and further questions, when you add some explaination to your intension. That would work only if you have mysql. If not, you should type all the path to the mysql. And Your syntax is wrong. SQL" More info here: wpy. Francesco Casula Francesco Casula To import a single database, use the following command.

Adeleke Akinade 5 5 silver badges 13 13 bronze badges. Leopathu Leopathu 6 6 silver badges 11 11 bronze badges. To import a database, use the following command. Madhusanka Edirimanna Madhusanka Edirimanna 6 6 silver badges 9 9 bronze badges.

This actually worked for me. Reuben Reuben 3, 2 2 gold badges 39 39 silver badges 53 53 bronze badges. Pritam Chaudhari Pritam Chaudhari 10 10 silver badges 10 10 bronze badges. On Windows, presumably? Why is it necessary to change to drive D:? Is file DbName. Disable with --disable-pager. If password is not given it's asked from the tty.

This may slow down the server if the output is suspended. Doesn't use history file. Used with --batch. Disable with --disable-reconnect. This option is enabled by default. Defaults to on; use --skip-reconnect to disable. Print results with a tab as separator, each row on new line. Does not work in batch mode. Disable with --disable-tee. Can any you one help?

Stack Overflow for Teams — Collaborate and share knowledge with a private group. Create a free Team What is Teams?

Collectives on Stack Overflow. Learn more. Asked 6 years, 6 months ago. Active 6 years, 6 months ago. Viewed times. Taheri Kh. Taheri 1 1 gold badge 10 10 silver badges 25 25 bronze badges.



0コメント

  • 1000 / 1000