Install MySQL under Linux and create a new user diagram tutorial for it

Source: Internet
Author: User

Overview of Ideas

1. Download the required installation package

(Linux under the wget download, the author downloaded under window, with xshell command RZ upload to Linux)

2. Install MySQL

3. Create a new user and authorize

Illustrated tutorials

First step : Detect system Version Information

Linux command: Cat/proc/version

The current Linux version is Redhat 4.1.2-48

Linux command: uname-a

You can see that the current system is 64-bit

Step two : Download MySQL Community Server

Official: http://www.mysql.com/downloads/mysql/

You can select "Linux-generic" to download the corresponding RMP package.

Because the current system is redhat (64-bit), select Oracle &red Hat Linux 4 & 5 directly

MySQL installs a lot of, the function also is different, in most cases only need to install Mysql-server and mysql-client, other package installs according to need.

Download the following two installation package files

mysql-server-5.5.28-1.rhel4.x86_64.rpm

mysql-client-5.5.28-1.rhel4.x86_64.rpm

Step three : Install MySQL

Installation Order: Install the server first and then install the client

Linux command: RPM-IVH mysql-server-5.5.28-1.rhel4.x86_64.rpm

Start MySQL after installation

Command:  /etc/init.d/mysql start

The startup succeeds as prompted.

MySQL default is no password, so you can directly connect the

MySQL default port is 3306, after the installation started successfully, you can use the command to view the 3306 port status

Command:  netstat-nat | grep 3306 or:  NETSTAT-NTLP

Fourth Step : Modify the MySQL password

Method One:

mysql> use mysql;mysql> desc user;

Mysql> Select Host, User, Password from user where user= ' root ';mysql> flush privileges;

Log out again to see the MySQL password modified successfully

Method Two:

[[email protected] ~]# mysqladmin-u root-p password root--here password after the root password is the target password Enter password:--The second password entered is the original MySQL password, Because the default installation is empty, you can enter it directly

Then log in with Root/root

Fifth Step

Create a new user for MySQL Dennisit/[email PROTECTED]#!PDP

Command:

Insert into Mysql.user (Host,user,password) VALUES (' localhost ', ' dennist ', Password (' [email PROTECTED]#!PDP ')];

To create a table for the user, and permissions, but partial authorization, can also be fully authorized, here all authorized to the table

Mysql> CREATE DATABASE Tb_newusrtb;mysql> grant all privileges on tb_newusrtb.* to [e-mail protected] identified by ' [Email PROTECTED]#!PDP ';mysql> flush privileges;

At this point, the task is complete, log in to the database with the new user

Use the command to view the MySQL user

Mysql> select Host,user,password from User;

Of course, you can also query their corresponding permissions. It's no different than a typical SQL query.

Reprint please specify the source [http://www.cnblogs.com/dennisit/archive/2012/12/26/2833818.html]

Install MySQL under Linux and create a new user diagram tutorial for it

Related Article

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.