MySQL Base Configration Instructions

来源:互联网 发布:lol韩服mac版 下载 编辑:程序博客网 时间:2024/06/04 18:43

一、Install MySQL Community Service

MySQL Community Edition is the freely downloadable version of the world’s most popular open source database.It is available under the GPL license.
You can use the “apt-get install” command of Ubuntu to install MySQL Database.

$ sudo apt-get install mysql-server 

Notes: When you install MySQL, you need to specify root account and password for MySQL.

$ sudo apt-get install mysql-client

After the MySQL installation is successful, MySQL server should start automatically. You can execute the following command to check MySQL server’s status:

$ sudo netstat -tap | grep mysql

The command is use to check listening port of MySQL, if these is listening port is exist that it is running.

二、MySQL Configration Instructions

1. Check to ensure that mysql server is running. It is not running, execute the following command to start it:

$ sudo /etc/init.d/mysql start 

$ sudo /etc/init.d/mysql stop

$ sudo /etc/init.d/mysql restart 

2. Login to mysql with root account.

$ mysql  -u root –p    // concrete format : mysql -u <UserName> -p [UserPassword]

3. Create  MySQL account:

Method one:

Mysql> insert into mysql.user(Host,User,Password) values("localhost","<UserName>",password("<UserPassword>"));

Mysql> flush privileges;

Method two:

Mysql> CREATE USER 'jeffrey'@'localhost' IDENTIFIED BY 'mypass';

If you specify only the user name part of the account name, a host name part of '%' is used.
The user specification may indicate how the user should authenticate when connecting to the server:
To enable the user to connect with no password (which is insecure), include no IDENTIFIED BY clause:

Mysql>CREATE USER 'jeffrey'@'localhost';

In this case, the account uses the default authentication plugin and clients must provide no password.
To assign a password, use IDENTIFIED BY with the literal plaintext password value:

Mysql>CREATE USER 'jeffrey'@'localhost' IDENTIFIED BY 'mypass';

The account uses the default authentication plugin and clients must match the given password.

4. Create  a database named “dellwyse” for PocketWeb Server :
Mysql> CREATE DATABASE <DatabaseName> DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;  
Notes: MySQL database name and table name are case sensitive in Linux. In Windows they are case insensitive.

5. Set access control permissions for user dellwyse.
Mysql> GRANT ALL PRIVILEGES ON *.* to '<UserName>'@'%' IDENTIFIED BY '<UserPassword>' WITH GRANT OPTION;

Mysql> GRANT ALL PRIVILEGES ON *.* to '<UserName>'@'localhost' IDENTIFIED BY '<UserPassword>' WITH GRANT OPTION;

// Mysql> GRANT ALL PRIVILEGES ON *.* to '<UserName>'@'< concrete IP Address>' IDENTIFIED BY '<UserPassword>' WITH GRANT OPTION;

Note: User grant information can view in mysql database's user table.

Mysql> flush privileges;

0 0
原创粉丝点击