Basic usage of mysql in windows I. mysql introduction
Mysql is a small and flexible database server software that is ideal for medium and small application systems. In addition to standard ansi SQL statements, mysql also supports multiple platforms. on unix/linux systems, mysql supports multithreading, in this way, we can obtain good performance. Like the first two software, it is open source software.
II. install mysql (windows version)
Decompress the downloaded file to a directory and run the setup program. The installation process is prompted. It is installed in c:/mysql by default. if you want to install it in other directories, there are still some changes. as a beginner, you can skip this step and install it in the default directory. After installation, go to the c:/mysql/bindirectory and run the mysqld-ware.exe file.
Run directly in win98. normally, there is no prompt
In nt, enter mysqld-inform Ware -- install to start the service.
Next, enter mysql. under normal circumstances, several lines of prompts will appear and the following symbol will appear:
Mysql>
By now, you have successfully installed mysql.
3. set the mysql User password
The default username for the mysql database is "root" (sa is similar to the MS SQL server), and the password is empty by default. Enter
C:/mysql/bin> "mysqladmin-u root-p password adminpassword
After you press enter, you will be prompted to enter the original password. because the original password is empty, press enter directly and change the password of the root user to "adminpassword.
IV. simple use of mysql databases
1. display the mysql database (note: If no prompt is displayed in the later part of this article, all the commands entered are at the mysql prompt)
Show databases
2. open a database
Use test
Test indicates the database name.
3. display all data tables in a database (a database must be opened first)
Show tables
Go
4. create a database as root (under the dos prompt)
Mysqladmin-u root-p password adminpassword create gsbook
Then you will be prompted to enter the password. Because our purpose is to make a message board. here I name the database "gsbook ".
5. add a data table to the database
Create table gsbook (id int not null auto_increment, primary key (id), nickname varchar (30), email varchar (30), homepage varchar (30), note text, w_time datetime)