Copy Code code as follows:
$conn =mysql_connect (' 192.168.0.220 ', ' root ', ' 123 ');
if (! $conn) echo "Failed!";
else echo "Success!";
An SQL statement that extracts information from a table
$sql = "SELECT * from user where username= ' $user _name '";
Execute SQL query
$result =mysql_db_query (' info ', $sql, $conn);
Get query Results
$row =mysql_fetch_row ($result);
Mysql_close ();
The first line of IP corresponding LAN a host, about the local area network
This article mainly introduces the usage examples of adding, deleting, querying, and modifying MySQL statements. it is an induction of the basic knowledge points of MySQL learning. For more information, see 1. create a column.
alter table tablename add colname type not null default '0′;
Example:
alter table mmanapp_mmanmedia add appid_id integer not null
Let's start with this section to learn how to apply Smarty to actual examples. To illustrate this, I'll take a site that I wrote before as an example. First of all, I am not very strong in art, so the design out of the page is not very good-looking, we will deal with the see
Before you look at this article, you can look at indexbak.htm and newsbak.htm, which are the examples we generated.
First, to explain what we are going to use the database, I wi
:
+ ---------------------------------- +
| Date_sub (now (), interval 100 day) |
+ ---------------------------------- +
| 14:00:20 |
+ ---------------------------------- +
1 row in SET (0.00 Sec)
2.6.7 data statistics
Use the count () function to calculate the number of table data (for example, the number of employees in the EMP table)
Mysql> select count (*) from EMP;
The query
Java database connection pool configuration methods (take MySQL database as an example), database connection mysqlSeveral configuration methods for Java Database Connection Pool (taking MySQL database as an example)
1. Tomcat configuration data source:
Prerequisites: You need to put the jar package for connecting to th
Master-slave replication is widely used in MySQL. it is mainly used to synchronize data on one server to multiple slave servers. it can be used for load balancing, high availability and failover, and backup. MySQL supports a variety of replication technologies, such as unidirectional, semi-synchronous, asynchronous, and complex master-slave replication technologies, which are widely used in
The LAST_INSERT_ID usage example of MySQL is bitsCN. example of LAST_INSERT_ID usage of comMySQL environment: MySQL Sever 5.1 + MySQL command line tool first look at an example (the primary key is auto-incrementing): [SQL]
Complete example of accessing mysql using C language
1. manually install mysql2 with mysql sdk. create a console project. add C:/Program Files/MySQL Server 5.5/include to the project attribute and add C: /Program Files/MySQL Server 5.5/lib add "Library Directory" 3. stdafx.
MySql stored procedure exception handling example bitsCN.com
MySql stored procedure exception handling example:
I checked a lot of information on the internet and found that the exception handling information about mysql is a list of error numbers, we may want to record more
Example of if in mysql statement bitsCN.com
Select *, if (sva = 1, "male", "female") as ssva from taname where sva
12.2. control flow functionsCASE value WHEN [compare-value] THEN result [WHEN [compare-value] THEN result...] [ELSE result] end case when [condition] THEN result [WHEN [condition] THEN result...] [ELSE result] ENDIn the returned results of the first scheme, value = compare-value. The returned
The following are examples of how to use MySQL to solve some common problems. Some examples use the database table "shop", which contains the price of each article (item number) of a merchant. Assume that each merchant's article has a separate fixed price, then (item, Merchant) is the primary key of the record. You can create an example database table as follows: CREATETABLEshop (articleI manual
Examples of MySQL common queries below are examples of how to use MySQL to solve some common problems. Some examples use the database table "shop", which contains the price of each article (item number) of a merchant. Assume that each merchant's article has a separate fixed price, then (item, Merchant) is the primary key of the record.
You can create an example
MySQL Reference Manual-examples of common queries below are examples of how to use MySQL to solve some common problems.
Some examples use the database table "shop", which contains the price of each article (item number) of a merchant. Assume that each merchant's article has a separate fixed price, then (item, Merchant) is the primary key of the record.
You can create an
1) Preparation before installation
① download MySQL, get the source package from the official website, Http://dev.mysql.com/downloads/mysql#wget http://cdn.mysql.com/Downloads/MySQL-5.6/mysql-5.6.27.tar.gz#tar XVF mysql-5.6.27.tar.gz#cd
MYSQL was installed in LINUX, and the empty ROOT password was changed when it was just installed. at that time, a memorable password was also changed. I did not expect to forget it in an hour, so with this password recovery process note, because the MySQL password is stored in the user table in the mysql database, you only need to copy the user table in
The MySQL stored procedure calls each other and obtains the error code example bitsCN.com.
Mysql>
Mysql> delimiter $
Mysql>
Mysql> create procedure myProc ()
-> MODIFIES SQL DATA
-> BEGIN
-> DECLARE l_status VARCHAR (20 );
->
-> C
transaction, data before name is saved, subsequent data is not saved.
Mysql uses the transaction keyword begin // to open a transaction commit // submit it to the database rollback // cancel the operation savepoint // save, partially cancel, partially submit alter table person type = INNODB // modify data engine
Example:
beginupdate person set name='efgh' where id =10select * from personrollbackselect * fr
JDBC: Javadatabaseconnectivity is how java connects to the database. Example of a static query: importjava. SQL. *; publicclasstest {staticStringdrivercom. mysql. jdbc. Driver; staticStringurljdbc: mysql: 10.108.27.48thunder; staticString
JDBC: Java database connectivity is how java connects to the database. An example
How many columns does a MySQL index have? A real test example of bitsCN.com can contain a maximum of 16 columns.
Create table test (
F1 int,
F2 int,
F3 int,
F4 int,
F5 int,
F6 int,
F7 int,
F8 int,
F9 int,
F10 int,
F11 int,
F12 int,
F13 int,
F14 int,
F15 int,
F16 int,
F17 int
);
Create index idx_test_16 on test (f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16 );
Create index idx_test_
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.