The following script is a simple command to execute a remote database query, and I believe we can all understand it, which is helpful to some brothers who need to automatically check the database or execute some statements every day, as long as you
Small projects sometimes need to use keyword search relevance sort, with Sphinx appear overkill, with the order of MySQL by against.Method One:
Copy Code code as follows:
SELECT * from articles where (title-like '%keywords% ') or
Create a table
The Simple Way
Copy Code code as follows:
CREATE TABLE Person (
Number INT (11),
Name VARCHAR (255),
Birthday DATE
);
Or is
Copy Code code as follows:
CREATE TABLE IF not EXISTS
Creating a Database
The simplest way:
Copy Code code as follows:
CREATE DATABASE my_db;
Or is:
Copy Code code as follows:
CREATE DATABASE IF not EXISTS my_db;
To create a UTF8-encoded database:
This example describes the MySQL pressure test script, shared for everyone to reference. Specifically as follows:
CREATE TABLE Dept
Copy Code code as follows:
CREATE Table Dept (/* Department Table * *
Deptno mediumint UNSIGNED not
MySQL provides standard SQL pattern matching and a format for extended regular expression pattern matching based on Unix utilities like VI, grep, and SEDOne, SQL mode
SQL pattern matching allows you to match any single character with "_", while "%"
When migrating to MySQL databases, it is sometimes necessary to migrate users and permissions within the source database. For this migration we can get the user's relevant permissions from the Mysql.user table to generate the corresponding SQL
This article describes the MHA to achieve the MySQL master-slave Database manual switching method, share for everyone to reference. The specific methods are as follows:
First, preparatory work
1, respectively in master and slave implementation of
View current connection system parameters: Show VARIABLES like '%char% ';
Mysql> Show variables like ' char% ';
+--------------------------+----------------
| variable_name | Value
+--------------------------+----------------
| character_set_client
In actual demand, the contents of a certain table must be replaced in bulk, the ordinary thinking process is as follows:Select outStr_replace replacementUpdate WriteActually this is extremely wasteful of resources and consumes resources, MySQL built-
#Path to installation directory. All paths are usually resolved relative to this.Basedir= "D:\MySQL Server 5.1/"#Path to the database rootDatadir= "D:\MySQL Server 5.1/data/"
However, because it is not installed, the service is not generated and
Without warning, MySQL went on strike. After starting with the Mysql.server startup script, there is no hint that the message ends, and the mysqld process is naturally not up.
Put the mysql.server inside $bindir/mysqld_safe--datadir=
(1) The simplest method of modification is to modify the character set key values in the MySQL My.ini file ,such as Default-character-set = UTF8Character_set_server = UTF8
After the modification, restart the MySQL services, service MySQL restartUse
Network environment:Host: Win7VirtualBox 4.1.4 + Ubuntu 11.10 Server 64bitHost use network cable, the client in bridged adapter mode, the use of Atheros AR8131 pci-e Gigabit Ethernet The Internet is no problem.When the host uses wireless, the client
Scenario One: Using the Ignore keyword
If the uniqueness of the record is distinguished by the primary key primary or unique index unique, it is possible to avoid duplicate insertion records:
Copy Code code as follows:
INSERT
If the MySQL server has binary logging enabled, you can use the Mysqlbinlog tool to recover data starting at a specified point in time (for example, from your last backup) until now or another specified point in time. "Mysqlbinlog: Utility for
1005: Failed to create table
1006: Failed to create database
1007: Database already exists, failed to create database
1008: Database does not exist, delete database failed
1009: Unable to delete database file causes database failure to be deleted
101
1. Select statements can be separated by carriage returns
$sql = "SELECT * from article where id=1"
and
$sql = "SELECT * from article
where id=1" can get the correct results, but sometimes it may be clearer to write separately , especially
Use the load command in MySQL to load the contents of the TXT file into a database table, for example, to create a table, the name is User, a field username; there is currently a db.txt file with a space-separated username, for example: Xiaowang
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