Package Pubcls;
Import java.sql.*;
/**
* MYSQL simple Operation class
* @author Itblt
*/
Public class Mysql
{
Public Connection Livecon = NULL ;
Public int dbwaittime = 3600;
Public String DbLang = "" ;
Mysqli encapsulates some advanced operations, such as transactions, while encapsulating many of the methods available during DB operations.
The most widely used place is the mysqli business.
Like the following example:
The code is as
If you are initially configuring PHP MySQL Apache, how do we test the PHP connection database successfully, just create a test.php file, and then save the following code to the file.
The code is as follows
Copy Code
mysql2xml.php class file: For backup mysql data!!
The code is as follows
Copy Code
Class Mysql2xml {protected $conn;protected $result;protected $tables;protected $saveFolder = ' datas/';Public function __construct
The code is as follows
Copy Code
Class MySQL {Private $db _host; Database HostPrivate $db _user; Database user NamePrivate $db _pwd; Database User name passwordPrivate $db _database; Database namePrivate $conn; database connection
In fact, Apache and MySQL are installed as a function of the system services, as follows:
The code is as follows
Copy Code
D:wwwrootapachebin>httpd-k Install
Register successfully If you are prompted with the
MySQL Group BY tutorial, is grouping Oh.
When you have mastered the basics of MySQL, it takes time to take the next step and take on the aggregate function. Before we talk about them, let's review the definition, overall, as it relates to
For example, there is a requirement, through the SQL statement, to return a random integer of 5 to 5. If this one is in PHP, it is very simple and straightforwardPrint rand ( -5,5);?>In MySQL, the RAND function can have only one parameter. Excerpt
Re-edit the encoding
First copy a my.cnf to/OPT/LOCAL/ETC/MYSQL5:
The code is as follows
Copy Code
$ cd/opt/local/etc/mysql5/$ sudo cp/opt/local/share/mysql5/mysql/my-small.cnf my.cnf
Then edit my.cnf and add
The installation process is as follows:
First you can see that this is the mysql5.0 installation interface, select next to always install to the 2nd Step diagram display interface.
Step2
Next to here, is to choose the installation method. Look at
Let's begin by telling you how to use mysqldump backup
SQL to back up the MyISAM table:
The code is as follows
Copy Code
/usr/local/mysql/bin/mysqldump-uyejr-pyejr--default-character-set=utf8--opt--extended-insert=false-
On Weibo, see @ Jinshan mentions a performance problem in MySQL,
The code is as follows
Copy Code
Select ID from table where ID > M ID
Which is faster?
There are three kinds of query conditions here:
Specific operations
MySQL supports the join syntax for select and some update and delete cases, with specific grammatical details:Table_references:Table_reference [, Table_reference] ...Table_reference:Table_factor| Join_tableTable_factor:Tbl_name [
Delete a duplicate record method:
1. Create a new temporary table
The code is as follows
Copy Code
CREATE TABLE tmp as SELECT * from Youtable Group by name (name is not expected to have duplicate columns)
2.
MySQL can assign strict, complex permissions to different users. Most of these operations can be implemented with SQL Directive grant (assigning permissions) and revoke (Reclaim permissions). Grant can assign the specified permissions to a specific
The code is as follows
Copy Code
#!/bin/bash# full && increment backup and recover# Description: Make sure that the/data/bak directory exists beforehand, and that you cannot find the position file if you have done at least one full
Using cursors (cursor)
1. Declaring a cursor
DECLARE cursor_name Cursor for select_statementThis statement declares a cursor. You can also define multiple cursors in a subroutine, but each of the cursors in a block must have a unique name.
First, the concept of the indexindexing is the way to speed up the retrieval of data in a table. The index of the database is similar to the index of the book. In books, the index allows users to quickly find the information they need without having
1. Introduction to Group by statement:The GROUP BY statement is understood in the literal sense of the English language as grouping (group) according to certain rules. Its role is to divide a dataset into small areas through certain rules, and then
You can add, delete, modify, and query a simple blog implemented by php + mysql. The effect is shown in the following figure:I. Database and table structureDatabase: testTable: micro_blog (only one table) field: id, title, date, content, hitsThe
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.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service