How to use Navicat for MySQL to connect to a local database and import data files
1. Introduction
Navicat for MySQL is a database management tool designed to simplify, develop, and manage MySQL. We can use Navicat for MySQL to connect to a remote database, or to connect to a local database. Using this tool, it is very convenient to view the table's data, or you can enter a SQL command to implement the query. However, it is not convenient to enter commands such as creating a table. Well, let's take a look at how to use Navicat for MySQL to create and query data in the database.
2. Connect to the database
First, you have to confirm that you have installed MySQL Server 5.1 and navicat for MySQL. This installation is very simple, many tutorials on the web, and the installation of general software almost. When installing MySQL Server 5.1, be aware of the option to select the character encoding gb2312 (Chinese). Well, the installation here will not say.
After installation, open the MySQL commend Line Client and enter the password, such as:
Now we're in the MySQL command window. We can create a database and a table here:
Mysql> CREATE DATABASE mydata;mysql> use mydata;mysql> CREATE TABLE Studentscore (name varchar) PRI Mary Key, number int (TEN), Department varchar (+), gender varchar (ten), birth int (ten), score Int (ten)) ;
Results such as:
The above lines have created a MyData database with a Studentscore table with the following columns: Name, number, department, gender, birth, score. Each type and primary key are also defined.
3. Importing data files using Navicat for MySQL
Open navicat for MySQL, and localhost local database connection, we can see the database and table just created, such as:
We can import the local TXT data file, as follows: (Here I delve not very deep, before all have been using remote database, import local TXT file to try, yes, attention to maintain the correct format)
The next step to note, if your database has Chinese data, the encoding format must choose to be Chinese GB2312.
The spacer is then a space (depending on the case in TXT). and select the target table, corresponding to each column one by one, you can import, such as:
How to use Navicat for MySQL to connect to a local database and import data files