In this paper, we understand the MySQL in Wamp integrated development environment with small white angle, which involves wide and shallow, which is the nature of guidance.
1. Start running MySQL in the familiar Wamp
There is a library, then a table, and the data is eventually inserted into the table as a record. Where the data is manipulated using SQL statements, SQL is a structured query language.
The MySQL database is already built into the WAMP, and you can start the MySQL service by doing the following (you must start the MySQL server each time you use the database)
2. Introduction to the console operation database
We can connect and manipulate the database via the console: (where the default is no password, the direct return is possible)
The commands that are commonly used in the console are show, create, drop, and so on:
mysql> show databases;
3. Introduction of phpMyAdmin Visual Operation database
The console is not easy to operate, so you can use phpMyAdmin to visualize MySQL database operation graphical interface (WAMP).
4. Basic knowledge of table-building and table operation
4.1, build the table:
When you create a table, you set the name, engine, encoding, and field information in the table.
You need to specify the engine when you build the table, different engines provide different functions;
fields are used to indicate what types of data are used in this table: int, varchar, data (date), text (up to 65535)
4.2. Table Operation:
Insert into Table name (field list) value (Value list)
SELECT * FROM table name
SELECT * FROM table name where
Delete from table name where condition
Update table name set field 1= value 1, field 2= value 2 .... Where condition
5. PHP Operation MySQL
5.1. Open MySQL Extension:
There are 3 types of extensions: ①mysql extension (old, basic not); ②mysqli extension; ③pdo extension;
5.2. To use MySQL extension as an example, use PHP to operate MySQL
is actually a function call, when the extension is opened, you can call the extension provided by the corresponding function to connect to the database, read and write delete operations. By default, the user name is root and the password is empty
The following several MySQL extensions open several important interfaces:
mysql_connect (MySQL server IP, username, password)
mysql_select_db
Mysql_query
Mysql_fech_array
1<?PHP2 $conn=mysql_connect("localhost", "root", "" ");3 mysql_select_db("MySQL",$conn);4 $results=mysql_query("Set names Utf-8");//Set Encoding5 $results=mysql_query("SELECT * from User");6 $row=Mysql_fetch_array($results);//Each call displays one, so a loop call is required7 Var_dump($row);8?>
Ago:
[Introduction to PHP] 1, from the installation and development environment to (Zhuang B) to do a cool landing application
[Introduction to PHP] 2, basic core Grammar outline
[Getting Started with PHP] 3, WAMP integrated MySQL-related basic operations