CentOS 7 Installation mariadb and detailed

Source: Internet
Author: User
1. CentOS 7.0 Version Information view
#cat/etc/redhat-release
2. Install MARIADB
#yum-y Install mariadb*
3.Connect mariadb
Error: Error 2002 (HY000): Can ' t connect to the local MySQL server through socket '/var/lib/mysql/mysql.sock ' (2)
4.solve the problem of not connecting
#systemctl Start Mariadb.service
#systemctl Enable Mariadb.service
# MySQL
5.Modify Root Password
Log in as root in the terminal, must
Enter mysqladmin-u root-p password root (this root is a password)
The following root is the password to set
Enter password appears after enter
Enter on the password, if not, direct return
6.Create a user
Create a user
mysql> INSERT INTO Mysql.user (Host,user,password) VALUES ("localhost", "admin", Password ("admin"));
Refresh System Permission Table
Mysql>flush privileges;
This creates a user named: admin Password: admin.
7.Create a database (under root permissions)
Create DATABASE MyDB;
Authorize the Admin user to have all the permissions for the MyDB database.
>grant all privileges in mydb.* to admin@localhost identified by ' admin ';
Refresh System Permission Table
Mysql>flush privileges;
8.deletes a user.
@>mysql-u root-p
@> Password
Mysql>delete from user WHERE user= "admin" and host= "localhost";
Mysql>flush privileges;
Delete a user's database
Mysql>drop database mydb;
9.modifies the specified user password.
@>mysql-u root-p
@> Password
Mysql>update Mysql.user Set Password=password (' New password ') where user= "admin" and host= "localhost";

mysql>flush privileges; 10.Navicat connection MySQL failed: Host ' * ' is not allowed to connect to-this MARIADB server
Problem Description: Navicat for easy administration, MySQL failed to connect Linux, such as The following error follows: Host ' * ' is not allowed to connect to this MARIADB server
//allow users to testuser from IP-222.129.1.1 hosts to MySQL server and use TESTPA ssWOrd as password    mariadb [(none)]> grant all privileges on *.* to   ' testuser ' @ ' 222.129.1.1 '  identified by  ' Testpassword '  with grant option;      (if you allow all ip:grant all privileges on *.* to  ' testuser ' @ '% ')  IDENTIFIED BY  ' Testpassword '  WITH GRANT OPTION;)    mariadb [(None )]> flush privileges;   //Refresh permission cache    mariadb [(none)]> show  privileges;   mariadb [(none)]> show grants for   ' TestUser ' @ 222.129.1.1 '     11. Delete an existing database

Using Rpm-qa | grep mariadb Search for mariadb existing packages:

If present, use rpm-e--nodeps mariadb-* Delete all: Remove MySQL All packages:

If present, use yum remove MySQL mysql-server mysql-libs compat-mysql51 all delete;

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.