Home >Backend Development >PHP Tutorial >Free mysql database Security knowledge you need to pay attention to when installing a newly installed MySQL database

Free mysql database Security knowledge you need to pay attention to when installing a newly installed MySQL database

WBOY
WBOYOriginal
2016-07-29 08:38:361080browse

On Unix (Linux), after installing MySQL according to the instructions in the manual, you must run the mysql_install_db script to create the mysql database containing the authorization
table and initial permissions. On Windows, run the Setup program in the distribution to initialize the data directory and mysql database. False
The server is also running.
When you first install MySQL on your machine, the authorization table in the mysql database is initialized like this:
You can connect as root from localhost without specifying a password. The root user has all rights (including administrative rights)
and can do anything. (By the way, the MySQL superuser has the same name as the Unix superuser, and they have nothing to do with each other.)
Anonymous access is granted to users who can connect locally to databases named test and any database whose name begins with test_. Anonymous users can do anything to the database, but have no administrative rights.
Connections to multiple servers from localhost are allowed, regardless of whether the connecting user uses a localhost hostname or a real hostname. For example:
% mysql -h localhost test
% mysql -h pit.snake.net test
The fact that you connect to MySQL as root without even specifying a password just means that the initial installation is unsafe, so as an administrator, what you have to do first
It should be to set the root password, and then depending on the method you use to set the password, you can also tell the server to reload the authorization table so that it knows about this change. (When the server starts, it reloads the tables into memory and may not know that you have modified them.)
For MySQL 3.22 and above, you can set the password with mysqladmin:
% mysqladmin -u root password yourpassword
For MySQL For any version, you can use the mysql program and directly modify the user authorization table in the mysql database:
% mysql -u root mysql
mysql>UPDATE user SET password=PASSWORD("yourpassword") WHERE User="root";
If You have an old version of MySQL, use mysql and UPDATE.
After you set the password, check whether you need to tell the server to reload the authorization table by running the following command:
% mysqladmin -u root status
If the server still lets you connect to the server as root without specifying a password, reload the authorization table :
% mysqladmin -u root reload
After you set the root password (and reload the authorization table if necessary), you will need to specify the
password any time you connect to the server as root
The above has introduced the free mysql database. The security knowledge that the newly installed MySQL database needs to pay attention to, including the content of the free mysql database, I hope it will be helpful to friends who are interested in PHP tutorials.

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn