Installation and configuration of MySQL under Ubuntu system

Source: Internet
Author: User
Keywords Password installation and configuration nbsp;
Tags access aliyun apt configuration html http install installation

&http://www.aliyun.com/zixun/aggregation/37954.html ">NBSP; The installation and configuration of MySQL under the Ubuntu system is as follows:

installing MySQL

sudo apt install mysql-server

This should be very simple, and I think everyone in the installation of the problem is not too much, so we do not say, the following we talk about configuration.

Configure MySQL

Note that under Ubuntu, MySQL defaults to only local access, and if you want other machines to be able to access it, then you need to change the/ETC/MYSQL/MY.CNF configuration file! Here's a step-by-step:

The default MySQL installation after the root user does not have a password, so first access to the root user:

$mysql-U Root

The reason for using-u root is that I am now a general user (Firehare), and if you do not add-u root, MySQL will assume that Firehare is logged in. Note that I did not enter root user mode here because it is not necessary. In general, the database in MySQL operation, there is no need to enter root user mode, only when the possibility of setting.

After entering MySQL, the most important thing is to set the root user password in MySQL, otherwise, the MySQL service is not safe to say.

Mysql> GRANT all privileges on *.* to root@localhost identified by "123456";

Note that I'm using 123456 as the root password, but the password is unsafe, please use the combination of uppercase and lowercase letters and numbers, and not less than 8 digits.

In this way, you set the root password in MySQL, and then use the root to create the database you need. Here I take xoops as an example:

Mysql>create DATABASE Xoops;

Mysql>grant all privileges in xoops.* to Xoops_root@localhost identified by "654321";

This creates a xoops_roots user with full access to the database Xoops. Later, the Xoops database is managed with xoops_root, without the need for root users, and the user's permissions are limited to the Xoops database.

If you want remote access or control, then you have to do two things:

One:

Mysql>grant all privileges in xoops.* to xoops_root@ "%" identified by "654321";

Allows xoops_root users to log on to MySQL from any machine.

Second:

$sudo gedit/etc/mysql/my.cnf

Old version

>skip-networking => # skip-networking

In the new version

>bind-address=127.0.0.1 => bind-address= your machine's IP

This allows other machines to access MySQL.

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.