Document directory
- 1. Enter the MySQL command to log on without entering the user name and password.
- 2. display the name of the database for the current operation to prevent misoperation.
- 3. Import text data
1. Enter the MySQL command to log on without entering the user name and password.
The configuration method is as follows. Create the file. My. CnF in the current directory of the user (my system is ubuntu12.10, note that there is a point in front of the file), and enter the following content to save it. Then open the terminal and enter MySQL to log on automatically.
[Client]
Host = localhost
Port = 3306
User = ssj (this is the MySQL user name)
Password = ssjpasswd (this is the password)
Database = test (test is the database name)
Loose-local-infile = 1 (to support importing text data)
2. display the name of the database for the current operation to prevent misoperation.
Enter prompt MySQL [\ D]> In the mysql client command line. When the database is set to test, the command line prompt changes from mysql> to MySQL [test]>
3. import text data. For example, if the text data is zhangsan 20 Lisi 30, the created table MT is create table mt (name varchar (10), age INT). You can use the following command to import the data. Load data local infile 'test.txt 'into Table Mt fields terminated by ''; # Fields terminated by'' indicates that fields are separated by spaces.
Note: If the preceding client configuration is used, you may be prompted that the load data command cannot be found. Add loose-local-infile = 1.