Mysql installation
- Download and install
wget http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm rpm -ivh mysql-community-release-el7-5.noarch.rpm yum install mysql-community-serverCopy the code
2. Start the service
service mysqld restart
Copy the code
- Set the password
mysql -u root
set password for 'root'@'localhost'=password('root');
Copy the code
- Set the permissions
mysql -u root -proot
grant all privileges on *.* to root@'%'identified by 'root';
Copy the code
- Checking character set
show variables like '%character%';
Copy the code
- Checking the database engine
show engines;
show variables like'storage_engine';
Copy the code
- Create a user
insert into mysql.user(Host,User,Password) values("%","test",password("1234"));
Copy the code
Note: “localhost” here means that the user can only log in locally, not remotely on another machine. If you want to log in remotely, change the “localhost” to “%” to indicate that you can log in from any computer. You can also specify that a machine can be logged in remotely. ERROR 1364 (HY000): Field ‘ssl_cipher’ doesn’t have a default value
Take the following approach
GRANT USAGE ON *.* test'@'%' IDENTIFIED BY '1234' WITH GRANT OPTION;
Copy the code
- User Authorization 8.1 Logging In to MYSQL as user ROOT
@>mysql -u root -p @> PasswordCopy the code
8.2 Create a database for the user (testDB)
mysql>create database testDB;Copy the code
8.3 Granting All Permissions of the testDB Database to the Test User (all permissions of a database) :
Mysql >grant all PRIVILEGES on testDB.* to test@localhost identified by '1234'; mysql>flush privileges; // Refresh the system permission tableCopy the code
* to username@localhost identified by “password “;
8.4 If you want to assign some permissions to a user, you can write:
Mysql >grant SELECT,update on testDB.* to test@localhost identified by '1234'; mysql>flush privileges; // Refresh the system permission tableCopy the code
8.5 Granting Certain Database permissions to the Test User:
mysql>grant select,delete,update,create,drop on *.* to test@"%" identified by "1234";Copy the code
/ / test users for all databases have the select, delete, update, create, drop permissions.Copy the code
//@”%” indicates that all non-local hosts are authorized, excluding localhost. (Set localhost address to 127.0.0.1, if set to real local address, do not know whether it is possible, no verification.) Grant all PRIVILEGES on testDB.* to test@localhost identified by ‘1234’; Can.