Connecting to a database
Here is the simplest PHP connection to the MySQL database code:
The code is as follows
Copy Code
$link =mysql_connect ("localhost", "root", "password");if (! $link) echo "Connect error";else
In the process of using a database, it is sometimes necessary to change its table structure, including changing the name of the field, or even changing the relationship between different database fields. The command that can achieve this change is
MySQL Modify field length
ALTER TABLE news Modify column title varchar (130);
ALTER TABLE name modify column field name type;
For example: the title field in the news table is 100 characters in length and is changed to 130 characters
ALTER TABLE
COUNT (*) it returns the number of rows retrieved, regardless of whether they contain null values.SELECT retrieves from one table without retrieving other columns, and when there is no WHERE clause, COUNT (*) is optimized to the fastest return speed.
FreeHost10 5G free PHP space to support FTP
The free php space size is: 5GB;
Monthly flow limit of: 50GB;
Support Ftp/web way to upload and manage documents;
Support PHP5, provide 5 MySQL database, and can manage database through phpMyAdmin;
Method One, modify directly in command mode
1, Myisamchk
To fix the MySQL database, there is also a command: Mysqlcheck
Mysqlcheck-a-c-o-r–all-databases-uroot-p//This command is the best way to optimize all DB databases.
The meaning of the
Problem: MySQL permissions are set correctly, but still cannot be accessed remotely. The 3306 port was not opened by Telnet.
Analysis: MySQL defaults to bind only 127.0.0.1, that is, only on this computer to access Port 3306.
In Linux
Workaround:
1. Delete from T1 where condition
2, delete t1 from T1 where condition
3, delete t1 from T1,t2 where condition
4, delete t1,t2 from t1,t2 where condition
The first 3 are feasible, and the 4th is not.
That is, simply use the DELETE statement to
For the first step, click the "Launch" button under your control Center
The second step, then see, directly click on the database above.
Third, start creating it. Click Create DATABASE.
Four, enter the relevant information.
1, to root add a password pass123:
First enter the directory Mysqlbin in DOS, and then type the following command
The code is as follows
Copy Code
Mysqladmin-u Root-password pass123
Note: Since Root does not
Install homebrew
Homebrew is a very useful Package manager under the Mac, and automatically installs the dependent packages to free you from the cumbersome software dependency installation.Installing homebrew is also very simple, just enter in the
Question: I created a table to hold the customer information, and I know that you can insert the information into the table with the INSERT statement, but how do you guarantee that you don't insert duplicate records?
Answer: You can prevent the
The code is as follows
Copy Code
Mysqldump-hhostname-uusername-ppassword databasename > Backupfile.sql
Back up the MySQL database to back up the MySQL database in a format with a delete table in the format with the deleted
1. Connect MySQL database The way to connect to a database in a shell is simply to specify a username, password, the name of the database to connect to, and then redirect to enter the MySQL statement as follows: Mysql-u username-p PASSWORD
Mysql "Every derived table must have its own alias" error solution, derivedalias
Mysql Every derived table must have its own alias error Solution
Every derived table must have its own alias
This statement means that each derived table must have its
How to list all databases of the mysql server mysql_db_nameDefinition and usageThe mysql_db_name () function considers that calling the mysql_list_dbs () function from the database name.This function returns the database name success or FALSE
Access can only use this same life-saving feature in windows, which makes me feel terrible and hard to switch access to mysql. However, I have found many articles on the internet and have not directly converted it. I heard that odbc can be used for
Features1Majorhost.com provides some of the most functional free hosting network services on the Internet. We are confident that we will beat any other free host... we can assure you of the following:10 GB storage space99.98% of servers run normally6
LAMP installation is often done by developers, and RPM installation is relatively easier. The installed rpm Package and dependent package can be found on the installation disc, of course, you can also download and install it online, such as in
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