Database backup Classes
How to use:
The code is as follows
Copy Code
Require_once ("backdata.class.php");$link = @mysql_connect ("localhost", "Database name", "password") or Die (' could not connect to server.
Grammar
Mysql_connect (Servername,username,password);
Example
In the following example, we store a connection in a variable ($con) in a script for later use. If the connection fails, the "Die" section is executed:
The code is as
。 The method that invokes the stored procedure.
A. If the stored procedure has in/inout parameters, declare a variable, input parameters to the stored procedure, the variable is a pair of PHP variables (also can not, just do not have PHP variables,
Direct cmd command mode using
The code is as follows
Copy Code
show databases;Show tables from db_name;Show columns from table_name to db_name;Show index from Talbe_name [from db_name];Show status;Show variables;Show
The following is a description of the main content of the article.
The code is as follows
Copy Code
Found_rows (): SelectRow_count (): UPDATE Delete Insert
Note: You need to work with the appropriate operation,
Principle Steps
1,php use mysql_connect to connect with MySQL database
2, open MySQL database
3, accept the page data, PHP input to the specified table
4, and then use Mysql_query to execute and save the SQL to the database.
Connection MySQL
The code is as follows
Copy Code
$conn = mysql_connect (' localhost ', ' root ', ' password ');Var_dump ($conn);?>
The basic is to change the configuration file php.ini
First, make sure that the Extension_dir = "./ext" in
1. Create a database connection2. Send some statements that are not necessary3. Select a stored database4. Write the database INSERT statement5. Send this statementLook at the data structure first
The code is as follows
Copy Code
Backup MySQL with mysqldump
1. Establish the file path to back up
# Mkdir/opt/bak/mysql/cxyI am the library for the path, MySQL under the storage of multiple libraries, cxy for the library2. Create Backup script files# vi/usr/sbin/mysqlbak.shInput
The same website program runs under Linux more quickly than in Windows, so decided to use Linux distribution CentOS, this article mainly explained under CentOS use Yum command to install the lamp detailed process. The software we use is the latest
In the production environment, we generally adopt mysqldump full-database backup, but this is not available for large databases, because mysqldump is a logical backup, and the efficiency of backup and recovery is slow, if a critical value is
= Start =Reason:Work needs, learning needs.Body:MySQL master/slave architecture:One MySQL instance acts as the master database and receives read/write requests. Another or more MySQL instances synchronize data from the master database to the slave
Previously, I saw a netizen in the group who had a large database when restoring the website, and did not use the mysql command to restore the database (detailed instructions on how to use the mysqldump command to back up and restore MySQL data ),
When I first came to the company today, the developers told me that mysql could not be started. I only knew that he had restarted all the services on the test server. At that time, I was so angry, I want to give him 124. If you say you want to
Mysql queries the number of records by page or under a certain condition, usually count (), so you know count (*), count (id), or count (name) are there any differences? Take a look at the figure below and you will understand it: Count (*)
1. How to obtain the latest MySQL version?To install MySQL, you must first obtain the latest version of MySQL. Although we all know that MySQL can be found in FreeBSD Packages, I suggest you go to the network to find the latest version of MySQL. I
◆ The default encoding of the mysql database tutorial is utf8. If this encoding is inconsistent with your php webpage, it may cause mysql garbled characters;◆ When creating a table in mysql, you will be asked to select an encoding. If this encoding
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