PHP & MySQL

Source: Internet
Author: User

1. Connect to the database

Shell:

Mysql-U $ user-P [$ database]

PHP:

$ Con = mysql_connect ($ host, $ dbauser, $ dbapassword );

2. display the database and select the database

Show databases;

Show tables;

Describe table;

Shell:

Use MySQL

PHP:

$ Db_selected = mysql_select_db ($ database, $ con );

3. query data

MySQL sub-command:

Select * from table where

PHP:

$ SQL = "select * From showlimits _ $ dtime order by r_rate DESC ";

$ Result = mysql_query ($ SQL, $ con );

Allow a host to access the database

MySQL sub-command:

Grant all privileges on *. * To 'root' @ '10. 26.170.14 'identified by 'mypassword' with grant option;
Flush privileges;

Mysql Data Type: http://www.cnblogs.com/bukudekong/archive/2011/06/27/2091590.html

Select now (); obtains the current time.

Phpadmin installation process: http://www.51099.com/comp/damy/20101012/353921.html

Related Article

Contact Us

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

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.