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
Database processing ClassesClass db{The data save variables after SQL execution;var $db;Reads or sets the location of the current datavar $position = 0;Execute the SQL statement and save the result
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
But today in a CMS, there is an unforgivable error, unable to connect to MySQL, wrote a test MySQL PHP file as follows:
The code is as follows
Copy Code
$link =mysql_connect (' localhost ', ' root ', ' root ');if (!
The code is as follows
Copy Code
mysql_connect ("localhost", "root", "1981427")//connection to the server at localhost, username root?>
Connect and then select Database
The code is as follows
Copy Code
This article introduces Python operation MySQL, execute SQL statement, get result set, traverse result set, get a field, get the name of the table field, insert the picture into the database, execute the transaction and so on various code examples
1, the installation of good Wamp, run the Wampserver program, into the MySQL console;
2, enter the console, prompted to enter the password (do not enter any password, because the password is empty), press ENTER enter;
3, input "use MySQL;" Then
MySQL supports a large number of column types, which can be grouped into 3 categories: numeric types, date and time types, and string (character) types. This section first gives an overview of the available types, summarizes the storage requirements
Here are two ways to describe each.Linux under:
2. Method one SQL script form
Action steps are as follows:
2.1. Export SQL ScriptOn the original database server, you can export the SQL script using the phpMyAdmin tool, or the mysqldump command
The code is as follows
Copy Code
mysql> Update ' table_name ' SET field = replace (field, '. rar ', '. 7z ');
TABLE_NAME: The name of the table to query,
Field name in the list,
Replace (field, '. rar ', '. 7z '); :
MySQL data to import export 500MB data
Problem: 500M of the library table data needs to be imported into the new database.
First access to MySQL through the consoleMysql-u Root-p 12345CREATE DATABASE ' demo ' DEFAULT CHARACTER SET UTF8 COLLATE utf8
Databases are IO-intensive applications whose primary responsibility is data management and storage. And we know that the time to read a database from memory is a microsecond level, while reading an IO from a common hard disk is at a millisecond
MySQL is a non-holding relay function and MYSQLI is a permanent connection function. Other words
MySQL each link will open a connected process and mysqli run mysqli multiple times will use the same connection process, thereby reducing the cost of
If you have forgotten the root password locally, try the following methods:
Open cmd first stop MySQL service
net stop MySQL
Enter the Bin folder in the MySQL installation directory and enter
Mysqld-nt--skip-grant-tables
Skip Password detection
If you forget the MySQL root password, you can reset it in the following ways:
Linux operating methods
In the MY.CNF [mysqld] field, add:
The code is as follows
Copy Code
Skip-grant-tables
Then restart your
Click the "SQL" tab on the top to enter the SQL command input interface. Enter the following command:Update mysql. user set password = PASSWORD ('snsgou $123456 ') where user = 'root ';Note: If you have changed the root password, you also need to
No matter ASP or PHP programming languages, or even other WEB languages, basic applications are nothing more than Database addition, reading, editing, and deletion requirements, complex functional projects are all centered around this. Chinese data
In the evening, when the website is busy again, a problem occurs when a large database is recovered. In Linux, backup data is directly backed up using commands, which is more complete than importing data directly from PHPMYADMIN, the same problem
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