Why does PHP choose MySQL as a database? Mysql Create user Method _php Digest

Source: Internet
Author: User
Tags mysql create mysql host mysql create user mysql database
1, why does PHP choose MySQL as a database?
2, MySQL database to create users
This article mainly writes MySQL creates the user's statement the difference, turns from Isher's blogspot, because in writes when thought why does not use other database, searches for Google why PHP will choose MySQL as the database, did not find the related report, the side decided to find the cause, At the same time this problem by my personal always feel out, do not represent the vast number of old PHP veteran group of comments, if not, please point out
Why does PHP choose MySQL as a database?

MySQL is the first open source database (based on GPL,GPL2 Open Source Protocol development, enjoy the principle of sharing, the existing part has been planned for commercial purposes), although it is free, but from performance and stability compared to other commercial databases, and PHP as the most similar to the C language program, the threshold is lower, and the free module release does not depend on any commercial servers, scalability, the Internet has a heavy open source library to provide PHP developers to use, so that PHP developers will be based on the same GPL developed MySQL database as a low-cost starting partner

2, MySQL Add users
Personal lesson, when adding a MySQL account, must be the user name and host (local and%) must be quoted, or the command is wrong
Command mode. Note that each line is followed by a command statement that ends.

Format: Grant Select on database. * to "username" @ "Login Host" identified by "password";

Example 1, add a user test1 password for ABC, so that he can log on any host, and all databases have query, insert, modify, delete permissions. First connect the root user to MySQL, and then type the following command:

Grant Select,insert,update,delete on *.* to "test1" @ "%" identified by "ABC";

To supplement all permission statements:

From Example 1: Will Execute permissions (Select,insert,....) Instead of all privileges, that means having all permissions, including creating database permissions, deleting the database, and not being limited to operating within a single database

GRANT all privileges in *.* to ' root ' @ '% ' identified by ' 123456 ';

The added user in Example 1 (not supplemental) is very dangerous because your host is%,% that represents any location, and local is the word "native", if someone wants to know the test1 password, Then he can connect to your MySQL database on any computer on the Internet and do whatever you want with your data, as shown in Example 2.

According to Example 1 Supplemental statement, this statement as far as possible not to use on the MySQL server, if your server is in the managed or remote zone, if you need to remotely manage the MySQL server, rather than through HyperTerminal to log on to the server, then you have to use this statement, but to understand one thing, That is, you can use this method to connect to the server, other people can also, so you have to take good care of your MySQL password

Example 2, add a user test2 password for ABC, so that he can only log on the localhost, and can query the database mydb, insert, modify, delete operations (localhost refers to the local host, that is, the MySQL database of the host), This allows the user to use a password that knows test2, and he cannot access the database directly from the Internet, only through a Web page on the MySQL host.

Grant Select,insert,update,delete on mydb.* to "Test2" @localhost identified by "ABC";

If you do not want to test2 the password, you can make another command to eliminate the password.

Grant Select,insert,update,delete on mydb.* to "Test2" @localhost identified by "";

Grant Select,insert,update,delete on dez.* to "test2" @ "%" identified by "123456";

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.