MariaDB password, new user added

Source: Internet
Author: User
Tags iptables

Change root password
1. Login as Root at the terminal (required)
2. Input mysqladmin-u root-p password ex
The back of the ex is the password to be set
3. Enter after carriage return password
Enter on the password, if not, enter directly

Open Remote access Permissions

MariaDB [(None)]> GRANT all privileges on * * to ' root ' @ '% ' identified by ' 123456 ' with GRANT OPTION;
Query OK, 0 rows Affected (0.00 sec)

MariaDB [(None)]> flush privileges;
Query OK, 0 rows Affected (0.00 sec)

If there is no way to access the remote, then open port 3306 is OK:

[[email protected] yum.repos.d]# iptables-a input-p TCP--dport 3306-j ACCEPT
[[Email protected] yum.repos.d]# service Iptables Save
[Email protected] yum.repos.d]# service iptables restart

Create user
Create user
mysql> INSERT INTO Mysql.user (Host,user,password) VALUES ("localhost", "admin", Password ("admin"));
Refresh System Permissions Table
Mysql>flush privileges;
This creates a user named Admin password: admin.

Create a database (under root privileges)
Create DATABASE MyDB;
The authorized Admin user has all the permissions of the MyDB database.
>grant all privileges in mydb.* to [e-mail protected] identified by ' admin ';
Refresh System Permissions Table
Mysql>flush privileges;

Delete the 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;

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;

MariaDB password, new user added

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.