1. Installation & Configuration
Using Ubuntu 16.04 LTS operating system, directly using the Apt-get install Mysql-server installation, the middle needs the database root user's password, records well. Use Mysql-v to view the version after the installation is complete.
Modify/ETC/MYSQL/MYSQL.CONF.D/MYSQLD.CNF Comments The following statements are available for other machines to access.
# bind-address = 127.0.0.1
2. Create a database
Use Mysql-u root-p to connect to the local database, prompting for and entering the password.
@>mysql-u root-p
Creating a database with the CREATE command format: Create databases < database name >; ( note to ";" End )
MySQL >CREATE database testdb;
After completion, enter "show Database;" command to see the currently created database.
MySQL >show database;
3. Create user, authorize
Create User: Test
MySQL >insert into mysql.user (Host,user,password) VALUES ("localhost", "Test", Password ("123456"));
Give the test user the TestDB Library all table additions and deletions, and can be accessed from the local (statement '% ' meaning)
MySQL >grant all privileges in testdb.* to [email protected] '% ';
Mysql>flush privileges; Refresh System Permissions Table
4. Create a table
First switch to TestDB, create table by creating tables, complete support through show tables to view the list of tables in the library, describe view the structure of the specified table.
mysql> use TestDB;
Mysql>create TABLE User (name varchar, addr varchar (50));
Mysql>show tables;
Mysql>describe user;
5. Inserting data
Inserting data through SQL statements.
Mysql>insert into user (name, addr) values (' User1 ', ' first user ');
6. Query data
queries through SQL statements.
Resources:
Create database and database tables with MySQL: http://database.51cto.com/art/200511/12524.htm
MySQL Add user, delete user and authorization: http://www.cnblogs.com/wanghetao/p/3806888.html
MySQL Installation and basic operation