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