Installation and configuration of MySQL under CentOS

Source: Internet
Author: User

I installed it through Yum, which is quick and easy.

1.yum install-y mysql-server Wait for installation to complete



2.chkconfig mysqld on set up MySQL service with system boot self-boot



3.[root@local ~]# chkconfig--list mysqld confirm MySQL self-booting
Mysqld 0:off 1:off 2:on 3:on 4:on 5:on 6:off If 2--5 is on the status OK

4./etc/rc.d/init.d/mysqld start mysql service

when MySQL was first installed, its root user was not set to the password. Start by setting up the root password for MySQL.

5.[root@sample ~]# mysql-u root log on to the MySQL server with the root user

6.mysql> Select User,host,password from Mysql.user; View user Information
Mysql>set password for [email Protected]=password (' Enter root password here '); Set Root password
Mysql>set password for [email protected] Domain name =password (' Enter root password here ');
Mysql> Delete from mysql.user where user= '; Delete anonymous user
Mysql> exit log out of MySQL server "Test setup password is correct"

7. Log in to database, create database and user

mysql> CREATE DATABASE ' mytest ' DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;

mysql> Grant all privileges the mytest.* to testuser@localhost identified by ' 123456 '; Establish a user named TestUser that has full operational permissions on the MyTest database

log in with the user you just created

8. Modify the location of the MySQL default storage database by default in:/var/lib/mysql/by directory

Modify the location of the following two items in the/ETC/MY.CNF to the new directory

Datadir=/var/data

Modify Vi/etc/rc.d/init.d/mysqld

You can restart MySQL.


Installation and configuration of MySQL under CentOS

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.