MySQL's HelloWorld

Source: Internet
Author: User

First, the use

Help developers quickly build a MySQL database service locally and introduce the use of some simple MySQL database services.

Second, software preparation "MySQL database Installation"

Windows platform as long as the website download MySQL database can be installed, after installation Remember to configure an environment variable mysql_home, easy to use in the command line prompt directly using MySQL.

Linux platform I use Yum to install, the instructions are as follows:

Yum Install MySQL Yum Install Mysql-server

MySQL database in the Linux platform under the C/S model software combination, the above installed MySQL as a client, mysql-server as a local database service.

Third, the simple use of MySQL database "Add Users"

Suppose you want to add a user named Test with a password of 123456. Methods are as follows

MySQL ' Test '@'localhost'123456';
"View and configure user rights"

The MySQL database saves all user information in a database named MySQL database, so just select the user's information in the Users table.

>Select * from user where user='test'\g;

In my environment, the information returned by the MySQL database is as follows

As you can see from the returned results, MySQL defaults to disallow all permissions for newly added users. Configure permissions in the following ways:

Turn on SELECT, INSERT, UPDATE, delete permissions

Select ' Test '@'localhost'"123456";

Turn on all permissions

' Voicenote '@'%'"123456";

The grant command used for the above two instructions is used to open permissions, and the REVOKE command is required to disallow permissions.

Disable all Permissions

' Test '@localhost;

A password is not required when the permission is disabled, and the to is changed from.

"CREATE DATABASE"

Create and delete a database testdatabase

Mysql
> CREATE Database testdatabase; > DROP database testdatabase;
"Create and delete tables"

Create and delete user tables

> CREATE table User (name varchar (255), password varchar (255> drop table user;

The MySQL database also provides a mechanism for creating temporary tables

> Create temporary table temp_user (name varchar (255), password varchar (255));

Third, supplementary

In front of our add account, the host set is localhost, so the account set cannot provide remote database services. If you need to provide remote database services, you need to change localhost to%.

MySQL's HelloWorld

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.