Decompress MySQL environment configuration and Entry 1, Environment configuration 1, unzip the mysql-noinstall-5.1.53-win32.zip, here I decompress to E: \ Language \ Java \ mysql-5.1.53-win32. 2. Create my. ini, the content is as follows: [WinMySQLAdmin] # specify the mysql Service Startup File Server = E: \ Language \ Java \ mysql-5.1.53-win32 \ bin \ mysqld-nt.exe [mysqld] www.2cto.com
# Set mysql installation directory basedir = E: \ Language \ Java \ mysql-5.1.53-win32 # Set the mysql database data storage directory, must be data, or \ xxx \ data datadir = E: \ Language \ Java \ mysql-5.1.53-win32 \ data [client] # set mysql client character set default-character-set = utf8 [mysqld] www.2cto.com default-character-set = utf8 3 install mysql Service (1) configure environment variables in the path variable, add E: \ Language \ Java \ mysql-5.1.53-win32 \ bin; (depending on your own installation directory) (2) install mysql. Open the DOS window and start-> Run (shortcut: win + r). Enter cmd and enter mysqld -- inst. Press ENTER for all mysql to check whether the service is successfully installed. (3) Start mysql and right-click my computer.-> Manage and click "service" under "services and applications ", right-click to start mysql service or enter net start mysql (4) in DOS window to enter mysql console ① ODBC user login: Enter DOS window, enter mysql, press enter, connect to the mysql server ② root user login :. enter mysql-u root-p. Description: mysql-u username-p password. Enter the password. The initial value is null. You do not need to enter www.2cto.com. Note: if you do not specify user and other enabling parameters, by default, ODBC users are used to log on. during the development process, the root user is generally used to operate the database. Select user (); command to display the current Login user • Change the root user password: www.2cto.com to ensure data security, add a password for the root user, steps are as follows: 1.use mysql; // select mysql database 2. update user set password = password ('new password') where user = 'root'; // change the password, for example, admin3.flush privileges; // The system permission table is refreshed and the change takes effect: in DOS, press the upper and lower keys on the keyboard. You can quickly switch between commands in history. 4. Common commands • view all databases show databases; • Select database use mysql; data addition, deletion, modification, and query are all for specific databases. You must select the database to operate before performing data operations. • View all tables in the database. • create database name;
The newly created database is saved in the data directory. Convenient dormitory-> lab Copy • create table Name (field setting list); • Execute SQL script files and operate source "path name" +/xxxx in batches. SQL; note: the direction of the slash (/) instead of \ • set the encoding set charset gbk. The MySQL command line window displays Chinese characters and must set the encoding to gbk. Otherwise, garbled characters are displayed! • View the character set show variables like 'character % '. For example, after connecting to MySQL, input (1) create databases helloworld in sequence under DOS; (2) create table student (www.2cto.com id int (10) primary key, number int (20) not null, name varchar (20) not null); (3) source E: /Language/Java/insert_student. SQL Note: The content of insert_student. SQL is insert into student values (4,411, 'zhang san'); insert into student values (2,222, 'Li si '); insert into student values (3,333, 'wang wu'); (4) set ch Arset gbk; www.2cto.com (5) select * from student; 5. The Navicat for MySQL command line is cumbersome and hard to remember. Navicat is a MySQL database management and development tool with excellent graphic user interface. Commands in the console window can be converted to Navicat operations. We recommend that you use command lines to operate databases. Deepen understanding of SQL statements to help you learn Database courses in the future.