I usually use two MySQL functions: Query and update, the following is their own commonly used functions of the package, we copy the past can be used directly.
FileName: dbutil.py
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
Method One:
(for administrators or users with global permissions to reset another user's password)Enter command line modeMysql-u Root MySQLmysql> UPDATE user SET Password=password ("New password") WHERE user= ' name ';mysql> FLUSH privileges;Mysql>
The simplest and most thorough method under Windows systems:1, stop the MySQL service2, in the MySQL installation directory to find My.ini, if not the My-medium.ini copy as a my.ini can3, after opening the My.ini, in [client] and [mysqld] below all
To install a document:Http://code.openark.org/forge/mycheckpoint/documentation/quick-howto#Install
Demand:1. Need to install Python, and version is greater than 2.4
Shell > Phthon See if there's any outfit, no
Yum install Python2. Need to install
Option Default-charaset-set=utf8;
It then creates a datasheet create TABLE a_table (b varchar (255) not NULL);
INSERT into a_table values (' Beijing ');
This time is inserted in Chinese and the system will report an error: Incorrect string value:
1, connect to each other MySQL server
Mysql-u root-h 192.168.0.1
Mysql.exe This program is in the bin directory where you have MySQL installed.
2. Let's take a look at some of the databases in the server
Mysql>show databases; MySQL default
100W of data for many friends, but today I thought of creating a large number of data test environment, so I looked for how to insert 100W data, I used 20 fields. In contrast, the first is to use the MySQL stored procedures to get:
The
Bulk find
Wildcard description_ and any single character match% matches a string that contains one or more characters[] matches any single character in a particular range (for example, [a-f]) or in a specific set (for example, [abcdef]).[^] matches
Tried google to several methods, did not solve, and then suddenly remembered in the launch of Apache, IIS port occupancy (because my Apache also uses 80 ports), so open the command line
Netstat-aon|findstr "3306"
Results show
Silently in the
InnoDB and MyISAM are the two most commonly used table types used by many people when using MySQL, each with its own pros and cons, depending on the specific application. The basic difference is that the MyISAM type does not support advanced
Question One
First step
The code is as follows
Copy Code
1. Download http://files.directadmin.com/services/all/mysql/mysql-5.1.50.tar.gz2.tar ZXVF mysql-5.1.50.tar.gz3.CP
FreeBSD version is 7.3,mysql version is 5.0.90,apache version is 2.2.14 (1.3.42), PHP version is 5.2.12. The order of my installation is MySQL first, then install Apache and PHP, is usually installed to complete a and test after the installation of
First step: Define your backup directory on your Linux server:
The code is as follows
Copy Code
Mkdir/var/lib/mysqlbackupCd/var/lib/mysqlbackup
The second step: The following is the most important step, is to
I. 10 sentences1. do not rely ON the register_global = ON environment, from the day when you just learned how to configure the php runtime environment and even do not understand the impact of register_global ON/off on yourself, we should be brave
SQL in MySQLFor MySQL, the first thing you must remember is that every line of its command is ended with a semicolon (;), ...... There is no such thing as absolute. The same is true here.As I mentioned earlier, when a MySQL line is inserted into the
A simple, clear, and simple unlimited classification example with indentation. You only need to query the data table once and recursively traverse the result set, to enable the column indent display in php, refer. The code is as follows:Copy code
Question 1Today I installed mysql and php on this book, everything is installed normally (php@IIS7.5-fastCGI ). However, the error "#2002 unable to connect" occurs when you use phpmyadmin to connect to the test. The same problem occurs with other
SolutionThe page is gb2312 The code is as follows:Copy code Mysql_qurey specifies that the database is decoded as "set names gb2312" to prevent Chinese garbled characters. Page code: uft8 The code is as follows:Copy code Mysql_query ('set
The following code connects to the 9tmd_bbs_utf8 database on the local MySQL server. The user name is obtained from the tbb_user table based on the input userid and printed and output to the terminal. The code is as follows:Copy code # If
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