MYSQL 4.0.21 in W2K

xiaoxiao2021-03-06  63

1, from

Www.mysql.com Download Recommended 4.0.21, I downloaded ZIP instead of installation

2, unzip files to a directory, I am e: / mysql, this directory should have Bin, Data and other directories

3, build a My.ini file in the C: / Winnt directory, write the following, to point out your installation path: [mysqld] # set basedir to your installation pathbasedir = E: / mysql # set datadir to the location of Your data DirectoryDataDir = E: / MySQL / DATA

4, test installation under DOS Command Line correct: Enter the E: / MySQL / BIN directory, use the command mysqld --console should display the following 040927 19:06:48 InnoDB: StartedMysqld: Ready for Connections.Version: '4.0. 21-Debug 'Socket:' 'Port: 3306 Source Distribution This means that mysql's service has started, listening to port 3306

Then at another DOS window closes mySQL service: mysqladmin -u root shutdown, see the window that just started Mysql is displayed: 040927 19:11:27 mysqld: Normal shutdown040927 19:11:28 InnoDB: Starting Shutdown ... 040927 19 : 11: 31 InnoDB: Shutdown Completed040927 19:11:31 MySQLD: Shutdown Complete indicates that it is closed.

5. Install MySQL to the service to let MySQL automatically start in the DOS window using the following command: mysqld --install, very simple. At this point, you can see more than a MySQL service in your computer, you can

Your own preference set it to automatic or manual startup.

6, whether the test service is installed successfully can see directly in the service panel that can be started, or you can use the command NET Start MySQL test with the DOS window, which is a Windows command. If there is an error in 1067, the general reason is that you have no pairs in My.ini in front step 3.

7. Use the following command to test whether the service has started successfully E: /> E: / mysql / bin / mysqlshowe: /> e: / mysql / bin / mysqlshow -u root mysqle: /> E: / mysql / bin / mysqladmin version Status Proce: /> E: / mysql / bin / mysql test: /> e: / mysql / bin / mysql -e "SELECT HOST, DB, User from DB" mysql -u root

8, connected to the database mysql -h host -u user -p from other machines, Host is the machine name (IP), User is a user name prompts you enter your password, if it is correct, you can use the prompt mysql> You can type / H or HELP; try

9, switch database, create table, insert, select test mysql> / u TestDatabase ChangeDmySql> Create Table Tab1 (C1 VARCHAR (10)); Query OK, 0 ROWS Affected (0.19 sec)

Mysql> INSERT INTO TAB1 (C1) VALUES ('1000'); Query OK, 1 ROW Affected (0.01 Sec) MySQL> Commit; Query OK, 0 Rows Affected (0.00 sec)

Mysql> Select * from tab1; ------ | C1 | ------ | 1000 | ---- 1 Row In Set (0.00 sec)

10, several useful functions and commands Select version (), current_date; select now (); select user ();

SHOW DATABASES; Show Tables; Describe TableName;

Grant All on DatabaseName. * To 'Your_Mysql_name' @ 'Your_Client_Host'; Create Database Menager;

Read the data from the local file to Table Load Data Local Infile '/Path/pet.txt' Into Table Pet;

11, SQL supports Select * from PET WHERE BIRTH> = '1998-1-1'; (Date format can be written) Select Name, Birth, Curdate (), (Year ()) - Year (Birth)) -

(Right (CURDATE (), 5)

In addition to IS / NOT IS, the results with NULL operations are NULLSELECT 1 = NULL, 1 <> NULL, 1 NULL; SELECT 1 IS NULL;

Regular expressions support SELECT * from PET WHERE NAME REGEXP '^ b'; select * from pet where name regexp '^ [bb]'; select * from PET WHERE NAME Regexp 'Fy $'

Select Database ();

12. Run MYSQL moremysql moremysql miSQL.outmysql -vvv: Really wants to see the running command

转载请注明原文地址:https://www.9cbs.com/read-111502.html

New Post(0)