1. Why does PHP choose MySQL as a database?
2. mysql Database creation user
This article mainly writes the difference that the MySQL creates the user's statement, turns from the Isher the Blogspot, because in the writing thought why does not exchange the other database time, searched the Google why PHP chooses MySQL to make the database, did not find the related report, decides to find the cause, At the same time this problem by my personal always feel, do not represent the vast number of PHP veteran group of opinions, if there is ill-conceived please point out
Why does PHP choose MySQL as a database?
MySQL is the first open source database (based on the GPL,GPL2 Open source Protocol development, sharing principle, the existing part has been planned to commercial use), although 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 as a free module release is not dependent on any commercial server, extensibility, there are a lot of open-source class library on the internet to provide PHP developers to use, so PHP developers to the same GPL-based MySQL database developed as a low-cost start-up partner
2. mysql Add user
Personal lessons, when adding MySQL account, must be the user name and host (local and%) are to be quoted, otherwise the command is wrong
Command mode. Notice that each line is followed by A; represents the end of a command statement.
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, use the root user to connect to MySQL, and then type the following command:
Grant Select,insert,update,delete on * * to ' test1 ' @ "%" identified by "ABC";
Add all permission statements:
By example 1: The Execute permission (Select,insert,....) Change to all privileges, which means that you have all permissions, including creating database permissions and deleting the database, and are not limited to working within a single database
GRANT all privileges on * * to ' root ' @ '% ' identified by ' 123456 ';
Example 1 (non-supplemental) added in the user is very dangerous, because your host is%,% that is the host in any location, and local is the word meaning "native", if, someone want to know test1 password, Then he can connect to your MySQL database on any computer on the Internet and can do whatever you like with your data, see Example 2 for a workaround.
According to the example 1 supplemental statement, this statement try not to use on the MySQL server, if your server is in a managed or remote area, if you need to remotely manage the MySQL server, and do not want to log on to the server through HyperTerminal, then you have to use this statement, but to understand one thing, That is, you can use this method to connect to the server, others can, so keep your MySQL password.
Example 2, add a user test2 password for ABC, so that he can only login on localhost, and the database mydb can query, insert, modify, delete operations (localhost refers to the local host, that is, the MySQL database host), This allows the user to use a password that knows test2, and he cannot access the database directly from the Internet, but 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 have a password, you can call another command to erase 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";
The above describes my life would suck without why does PHP choose MySQL as a database? Mysql creates a user method that includes the contents of my life would suck without, and I want to be helpful to a friend who is interested in PHP tutorials.