MySQL basic knowledge

Source: Internet
Author: User

Use sync Notes for Notes to blog to test! Knowledge point is a bit miscellaneous, to organize (local debugging) to establish a site:
1: Establish the domain name IP correspondence in the Hosts file (C:\WINDOWS\SYSTEM32\DRIVERS\ETC):
127.0.0.1 www.****.com//2: Create a new site in the Apache configuration file:--site path cannot have Chinese
<virtualhost *:80>
ServerName www.****.com
DocumentRoot "Project Absolute path"
<directory "Project Absolute path" >
Options Indexes
Order Deny,allow
Allow from all
</Directory>
</VirtualHost>//3: Restart Wamp all services. To connect to a database prerequisite action:
//(1). Connect to Server
(2). Set a unified receive encoding
(3). Select the database where the data is storedThe above code can be integrated into one sentence://$con = Mysqli_connect ("servername", "username", "password") or Die (' connection server failed, failure reason: '. mysqli_connect_ Error ()); $con = Mysqli_connect ("servername (usually localhost)", "username", "password");
if ($con)
{
Echo ' Connect server successfully ';
echo "<br/>";
}
Else
{
Die (' connection server failed, reason for failure: '. Mysqli_connect_erro ());
}

Mysqli_query ($con, "Set names ' UTF8 '");

Similarly, the following code can be integrated into one sentence://$result = mysqli_select_db ($con, "tablename") or Die (' Select Table Failed '. Mysql_error ()); $result = mysqli_select_db ($con, "Bloge");
if ($result)
{
Echo ' Select Database Success ';
}
Else
{
echo ' Select table failed, failure reason: '. mysql_error ();
If you have not yet created a database and built a table:
To create a database:
Create database name CharSet UTF8;
To create a table:
CREATE TABLE Liuyanbiao (
ID int primary KEY auto_increment,
xingming varchar () NOT NULL,
Biaoti varchar (+) NOT NULL,
Fabushijian datetime NOT NULL,
Neirong varchar (1000),
Huifu varchar (1000)
) charset UTF8;)



From for notes (Wiz)



MySQL basic knowledge

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.