MySql database is the first choice for Small and Medium-sized website back-end databases because it is free for non-commercial applications. website developers can build a Linux + Apache + PHP + MySql platform, which is the most cost-effective and efficient platform. mySql documentation is a good reference for beginners when using MySql for development. this article describes how to use MySql with caution.
MySql database is the first choice for Small and Medium-sized website back-end databases because it is free for non-commercial applications. website developers can build a Linux + Apache + PHP + MySql platform, which is the most cost-effective and efficient platform. mySql documentation is a good reference for beginners when using MySql for development. this article describes how to use MySql with caution.
MySql database is the first choice for Small and Medium-sized website back-end databases because it is free for non-commercial applications. website developers can build a "Linux + Apache + PHP + MySql" platform, which is the most cost-effective and efficient platform. mySql documentation is a good reference for beginners when using MySql for development. this article is my little experience in using MySql.
Currently, most of your development environments are Windows or Linux. You can download the relevant versions for installation. MySql exists as a service in windows. Make sure that the service has been started before use, the net start mysql command is not enabled. In Linux, the "/etc/rc. d/init. d/mysqld start" command is available. Note that the initiator must have administrator privileges.
The newly installed MySql contains a root account with a blank password and an anonymous account, which poses a major security risk. For some important applications, we should improve the security as much as possible, here, you should delete anonymous accounts and Set passwords for root accounts. You can run the following command:
Use mysql;
Delete from User where User = "";
Update User set Password = PASSWORD ('newpassword') where User = 'root ';
If you want to restrict the logon terminal used by the User, you can update the Host field of the corresponding User in the User table. After making the above changes, restart the database service ,, at this time, the following commands can be used for Logon:
Mysql-uroot-p;
Mysql-uroot-pnewpassword;
Mysql mydb-uroot-p;
Mysql mydb-uroot-pnewpassword;
The preceding command parameters are part of common parameters. For details, refer to the documentation. Here, mydb is the name of the database you want to log on.
In development and practical applications, users should not only use root users to connect to the database. Although it is convenient to use root users for testing, it will bring significant security risks to the system, it is not conducive to the improvement of management technology. We grant the most appropriate database permissions to the users used in an application. For example, a user who only inserts data should not be granted the permission to delete data. MySql User management is implemented through the User table. There are two common methods to add new users. One is to insert the corresponding data rows in the User table and set the corresponding permissions; the second is to use the GRANT command to create a user with certain permissions. The common usage of GRANT is as follows:
Grant all on mydb. * to identified by "password ";
Grant usage on *. * to identified by "password ";
Grant select, insert, update on mydb. * to identified by "password ";
Grant update, delete on mydb. TestTable to identified by "password ";
To GRANT the user the ability to manage permissions on the corresponding object, you can add the with grant option after GRANT. For users inserted into the User table, use the Password function to update and encrypt the PASSWORD field to prevent unauthorized users from stealing the Password. Users who do not need permissions should be cleared, and those who pass the permissions should be revoked in a timely manner. To REVOKE permissions, you can update the corresponding fields in the User table or use the REVOKE operation.