root[/root/Downloads]#service mysqld start
Redirecting to /bin/systemctl start mysqld.service
root[/root/Downloads]#service mysqld status
Redirecting to /bin/systemctl status mysqld.service
* mysqld.service - MySQL Server
Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled)
Active: active (running) since Fri 2020-01-17 17:31:50 CST; 1min 9s ago
Docs: man:mysqld(8)
http://dev.mysql.com/doc/refman/en/using-systemd.html
Process: 9309 ExecStart=/usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pid $MYSQLD_OPTS(code=exited, status=0/SUCCESS)
Process: 9259 ExecStartPre=/usr/bin/mysqld_pre_systemd (code=exited, status=0/SUCCESS)
Main PID: 9312 (mysqld)
CGroup: /system.slice/mysqld.service
`-9312 /usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pid
Jan 17 17:31:41 master systemd[1]: Starting MySQL Server...
Jan 17 17:31:50 master systemd[1]: Started MySQL Server.
root[/root/Downloads]#cat /var/log/mysqld.log | more
2020-01-17T09:31:41.520178Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see
documentation formore details).
2020-01-17T09:31:43.673005Z 0 [Warning] InnoDB: New log files created, LSN=45790
2020-01-17T09:31:43.999679Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.
2020-01-17T09:31:44.076853Z 0 [Warning] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generati
ng a new UUID: 2cb67942-390c-11ea-b3c0-0050568de698.
2020-01-17T09:31:44.083281Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
2020-01-17T09:31:44.671140Z 0 [Warning] CA certificate ca.pem is self signed.
2020-01-17T09:31:45.301369Z 1 [Note] A temporary password is generated for root@localhost: dearq:hM1B6p
# 登录mysql
root[/root/Downloads]#mysql -uroot -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.7.29
# 设置密码安全策略
mysql>set global validate_password_policy=0;
Query OK, 0 rows affected (0.00 sec)# 设置密码
mysql>set password='zxxxv81';
Query OK, 0 rows affected (0.00 sec)
4,创建数据库,创建用户,授权
# 创建数据库
mysql> CREATE DATABASE itest CHARACTER SET 'utf8';
Query OK, 1 row affected (0.00 sec)# 使用数据库itest
mysql> USE itest;
Database changed
# 创建用户itest 失败
mysql> CREATE USER 'itest'@'%' IDENTIFIED BY 'smarttest';
ERROR 1819 (HY000): Your password does not satisfy the current policy requirements
# 查看密码要求
mysql> SHOW VARIABLES LIKE 'validate_password%';
+--------------------------------------+--------+
| Variable_name | Value |
+--------------------------------------+--------+
| validate_password_check_user_name | OFF || validate_password_dictionary_file ||| validate_password_length | 5 || validate_password_mixed_case_count | 1 || validate_password_number_count | 1 || validate_password_policy | MEDIUM || validate_password_special_char_count | 1 |
+--------------------------------------+--------+
7 rows inset(0.01 sec)# 设置密码安全策略
mysql>set global validate_password_policy=LOW;
Query OK, 0 rows affected (0.00 sec)# 创建用户itest
mysql> CREATE USER 'itest'@'%' IDENTIFIED BY 'smarttest';
Query OK, 0 rows affected (0.00 sec)# 授权itest数据库给itest用户
mysql> GRANT ALL ON itest.* TO 'itest'@'%' IDENTIFIED BY "smarttest";
Query OK, 0 rows affected, 1 warning (0.00 sec)# 让授权立刻生效
mysql> FLUSH PRIVILEGES;