root@linfan ~]# mysql -uroot -p Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection> Server version: 5.7.22 MySQL Community Server (GPL)
Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> create database zabbix character set utf8 collate utf8_bin;
Query OK, 1 row affected (0.01 sec)
mysql> grant all privileges on zabbix.* to zabbix@localhost> Query OK, 0 rows affected, 2 warnings (0.01 sec)
mysql> grant all privileges on zabbix.* to zabbix@127.0.0.1> Query OK, 0 rows affected, 1 warning (0.00 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.02 sec)
mysql> show grants for zabbix@localhost;
+------------------------------------------------------------+
| Grants for zabbix@localhost |
+------------------------------------------------------------+
| GRANT USAGE ON *.* TO 'zabbix'@'localhost' |
| GRANT ALL PRIVILEGES ON `zabbix`.* TO 'zabbix'@'localhost' |
+------------------------------------------------------------+
2 rows in set (0.00 sec)
mysql> show grants for zabbix@127.0.0.1;
+------------------------------------------------------------+
| Grants for zabbix@127.0.0.1 |
+------------------------------------------------------------+
| GRANT USAGE ON *.* TO 'zabbix'@'127.0.0.1' |
| GRANT ALL PRIVILEGES ON `zabbix`.* TO 'zabbix'@'127.0.0.1' |
+------------------------------------------------------------+
2 rows in set (0.00 sec)
mysql> quit
Bye
[root@linfan ~]# cd /usr/src/zabbix-3.4.12/database/mysql/
[root@linfan mysql]# ls
data.sql images.sql schema.sql
//倒着追加
[root@linfan mysql]# mysql -uzabbix -plinfan123 zabbix < schema.sql
mysql: [Warning] Using a password on the command line interface can be insecure.
[root@linfan mysql]# mysql -uzabbix -plinfan123 zabbix < images.sql
mysql: [Warning] Using a password on the command line interface can be insecure.
[root@linfan mysql]# mysql -uzabbix -plinfan123 zabbix < data.sql
mysql: [Warning] Using a password on the command line interface can be insecure.