Lamp or LNMP environment, if MySQL is installed independently, you need to authorize:
Standalone installation of MySQL on a single server
After installation, optimize the server.
Authorized
Examples are as follows:
Create user
CREATE USER Demo identified by "Passwd123";
Authorize the use of all tables below the MySQL database
GRANT all privileges the Mysql.* to ' demo ' @ '% ' of ' identified by ' passwd123 ' with GRANT OPTION;
FLUSH privileges;
-------------------------------------------------------------------------------------------
Example Two
Authorizing all databases to connect to MyUser
CREATE USER MyUser identified by "MyPassword";
GRANT all privileges on * * to ' myuser ' @ ' percent ' identified by ' MyPassword ' with GRANT OPTION;
FLUSH privileges;
Example Three
Authorize all databases to connect myuser from 192.168.1.3
GRANT all privileges on * * to ' myuser ' @ ' 10.89.1.30 ' identified by ' MyPassword ' with GRANT OPTION;
FLUSH privileges;
4.web Server Connectivity Test
[Email protected] blog]# VI oldboy_mysql.php
<?php
$link _id=mysql_connect (' 10.89.1.30 ', ' myuser ', ' mypassword ') or mysql_error ();
if ($link _id) {
echo "MySQL _ok ()";
}
else {
echo "MySQL _error ()";
}
?>
This article is from the "Knowledge Change Destiny" blog, please be sure to keep this source http://ahtornado.blog.51cto.com/4826737/1891276
Lamp or LNMP environment set up the standalone MySQL database