How to install MYSQL database in Ubuntu

Source: Internet
Author: User
Tags bind flush create database

1. Install MySQL

Sudo apt-get install mysql-server
2. Modify the MYSQL root user password

After the default MySQL installation, the root user does not have a password. Therefore, use the root user to enter:
$ Mysql-u root-p
Mysql> use mysql; update user set password = PASSWORD ('panpan') where user = 'root'; flush privileges;
Change password to panpan
3. Modify the remote access permission of the MYSQL root user

First, modify the configuration file sudo vim/etc/mysql/my. cnf.
Bind-address = 127.0.0.1 => bind-address = IP address of your machine
Restart mysql
Sudo/etc/init. d/mysql restart

Log on to mysql from the local machine: mysql-u root-p
Then enter the password panpan
Use mysql;
Grant all privileges on. to root @ "%" identified by "panpan" with grant option; flush privileges;
Enter the mysql database to check whether the data with host % is added: use mysql; select * from user;

In this way, you can use navicat to log on to 3306/192 .168.1.21/root/panpan.
4. Add a new user panyingyun and create a database mame so that it can only access the mame database

Log on to mysql from the local machine: mysql-u root-p
Mysql> create database mame;
Mysql> grant all privileges on mame. * to panyingyun @ "%" identified by "panpan" with grant option; flush privileges;
In this way, you can use navicat to log on to 3306/192 .168.1.21/panyingyun/panpan.

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.