Connecting to the MySQL database
The code is as follows
Copy Code
$link = mysql_connect ("localhost", "Mysql_user", "Mysql_password")Or Die ("Could not connect:".) Mysql_error ());Print ("connected
The code is as follows
Copy Code
* 1, connect the server 2, all kinds of SQL action*/Class mysql{Private $host; Server addressPrivate $name; User namePrivate $pass; PasswordPrivate $table; Connecting to a database tutorialPrivate
/*
The code is as follows
Copy Code
* Created on 2010-4-21** The class for control MySQL** Made by S71ence** @ $host* @ $user _name* @ $user _pwd* @ $data _base* @ $coding*/Class MySQL{private $host;//Host NamePrivate
itself MySQL will generate a bunch of mysql.bin.* of the log, for our small web site, there is no real big use, and may be stuffed with our hard drive. Under normal circumstances, the little night will shut him, anyway I have every hour of mysqldump
If you have a table that looks like this:
ID
name
1
Tom
2
John doe
3
Harry
We generally query multiple data when the condition is usually a certain intervalsuch as: ",",
Cases
The code is as follows
Copy Code
Example: There are importdata.sql files, the contents of which are as followsSET sql_mode= "No_auto_value_on_zero";CREATE TABLE ' BBS ' (' id ' int (one) not NULL auto_increment,'
First, the database design
Moderation of the inverse paradigm, the attention is moderate
We all know the three paradigms, the model based on the three-normal paradigm is the most efficient way to save data and the easiest mode to extend. When we
1. True connection modification. It is slower when there is more data, and can affect read performance when modified. My_table is the table of operations, InnoDB is the new storage engine.
The code is as follows
Copy Code
The MySQL primary and standby architecture is based on the MySQL incremental log and differs from the master-slave replication structure.In the primary replication structure, the data inventory changes on either of the two servers are synchronized
I want to connect to a database on my colleague's machine. In the account password everything is correct situation, or encountered a few problems.
1, FirewallBy telnet colleague Machine IP 3306, the result is not even on. have dealt with similar
Class if there is a reply form for a post, posts (ID, TID, subject, message, Dateline),
ID for the automatic growth field, Tid for the reply to the topic of the ID (Foreign key Association), subject for reply to the title, message for the reply,
To increase user action rights
Grant all privileges in ' db_name '. * to ' user_name ' @ ' HOST ' with GRANT OPTION;
Grant normal data user, the right to query, insert, UPDATE, and delete all table data in the database.
Grant SELECT on testdb.*
Let's take a look at the following examples:
The code is as follows
Copy Code
TableID Name1 A2 b3 C4 C5 b
The library structure is probably like this, this is just a simple example, the actual situation will be
FileName mysql_data_backup.sh (requires permission to execute)
MySQL database table automatic backup Shell Script (second edition)
Call Example:
The code is as follows
Copy Code
mysql_data_backup.sh
Include
Use phpMyAdmin to import the database, but there are file upload size limits, upload time, timeout and other issues, the use of shell commands more convenient.
First step: Open cmd. Start--> cmd
Step two: Switch to MySQL installation directory
The code is as follows
Copy Code
#!/bin/bashRoot_path=/data/backup#进入备份文件存放目录CD $root _path#备份文件名, System Current time (year-month-day), note ' + ' after no blank spacesfile_name=$ (date + "%y-%m-%d"). sql#username: username,
Php + mysql image input and outputI have read the online example ~ Used ~ No problem found when images are imported to the database ~ However, the output always reports an error ~The code is as follows:Database creation:Create table Images (PicNum
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