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