HI, I'm still rookie guy with mysql database, I have a mysql script file called "MYBox" in notepad and I want to export to the one of folder directory but I don't know to do that from Does.

I need someone help me what command do I need to type in does to export Mybox file please.

Thanks.
AM

Dani AI

Generated

Following the exchange between and , a few practical clarifications and a simple, reliable workflow are useful.

A .txt file will import fine as long as it contains valid SQL statements (CREATE TABLE, INSERT, etc.). The target database must already exist unless the script itself creates it. Flags like -u and -p are passed when starting the MySQL client from the Windows shell (Command Prompt / cmd.exe), not typed at the mysql> interactive prompt.

A straightforward approach that keeps error messages visible is to start the MySQL client, create or select the database, then use the client’s SOURCE command to run the file:

mysql -u root -p

-- at the mysql> prompt:
CREATE DATABASE IF NOT EXISTS domes;
USE domes;
SOURCE C:/full/path/to/domes.txt;
SHOW TABLES;

This shows any SQL errors inline and verifies what was created.

Common pitfalls and troubleshooting

  • File contents: confirm each SQL statement ends with a semicolon. If the script only contains INSERTs, the destination tables must already exist.
  • Encoding: Notepad can save files in encodings (UTF-16 with BOM) that confuse MySQL. Save as ANSI or UTF-8 without BOM, or use an editor like Notepad++.
  • Paths and permissions: Supply a full path to SOURCE if the file isn’t in the mysql client’s working directory. The MySQL user must have CREATE/INSERT privileges for the chosen database.
  • Verification: use SHOW DATABASES;, USE domes; and SHOW TABLES; (inside the client) to confirm success. If running the import from cmd.exe, capture error output to see why statements may have failed.

These points expand on ’s suggestion about using the Windows command shell and correct the confusion in the example that began with mysql> — that prompt is interactive, so connection options belong on the command line that starts the client, or use SOURCE after connecting.

Recommended Answers

All 5 Replies

if that file actualy create table and than insert some vulues you can simple run command prompt

mysql -u user_name database_name<your_textfile+extension -p

[I]so it can look like this[/I]

mysql -u root dvdDatabase<myDvds.sql -p

then it will ask you for db password

thank you for your help, please correct me if I'm wrong, the file that i have is called domes.txt and to make new database by run execute file by going to

mysql> -u Username domes<domes.sql -p

is this is correct! if so then why i did not showing on the database list!

please help!

AM

if that file actualy create table and than insert some vulues you can simple run command prompt

mysql -u user_name database_name<your_textfile+extension -p
 
[I]so it can look like this[/I]
 
mysql -u root dvdDatabase<myDvds.sql -p

then it will ask you for db password

  1. database to which you want to import your tables must exist, if not create it
  2. for import/export I do not use MySQL command prompt Client but Windows Command Prompt, that is why there are options(-u for user, -p for password), my mistake I should mention it. When importing make shore that you are in the same directory as the file which you want to import into database as typing full path is usualy problematic( plenty of spelling mistakes), so use cd.. to move out of current folder, dir to list content of folder and cd my_folder/sub_folder to enter into a folder

if you still have problem let me know

Peter;

thanks for your response, when you said you do not use command prompt but window command, i think that must be easier to use. can you let me know which program from window command to use!

please correct me if I'm wrong.

1) the first step is that to create empty database called "domes"
2) then run execute .txt file of "domes.txt" and will convert to the sql in new database of "domes.sql"

Is this is correct step what I'm suppose to do!

Is that possible for me to send you small txt file sql script and you can take look for few minutes then you might have better idea of what you think i should do better way.

please let me know thanks.

Alidad


  1. database to which you want to import your tables must exist, if not create it
  2. for import/export I do not use MySQL command prompt Client but Windows Command Prompt, that is why there are options(-u for user, -p for password), my mistake I should mention it. When importing make shore that you are in the same directory as the file which you want to import into database as typing full path is usualy problematic( plenty of spelling mistakes), so use cd.. to move out of current folder, dir to list content of folder and cd my_folder/sub_folder to enter into a folder

if you still have problem let me know

Peter;

thanks for your response, when you said you do not use command prompt but window command, i think that must be easier to use. can you let me know which program from window command to use!

please correct me if I'm wrong.

1) the first step is that to create empty database called "domes"
2) then run execute .txt file of "domes.txt" and will convert to the sql in new database of "domes.sql"

Is this is correct step what I'm suppose to do!

Is that possible for me to send you small txt file sql script and you can take look for few minutes then you might have better idea of what you think i should do better way.

please let me know thanks.

AM

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.