Lamp or LNMP environment set up the standalone MySQL database

Source: Internet
Author: User

Lamp or LNMP environment, if MySQL is installed independently, you need to authorize:

    1. Standalone installation of MySQL on a single server

    2. After installation, optimize the server.

    3. 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

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.