In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-15 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
For the newly installed MySQL5.7, the password was prompted to be wrong when logging in, but the password was not changed during installation. Later, the password was changed through password-free login. When entering update mysql.user set password=password ('123456') where user='root', it prompts ERROR 1054 (42S22): Unknown column' password' in 'field list', originally does not have the password field under the mysql database, and the password field has been changed to
Authentication_string
The image above is annotated after setting the root password.
Go to mysql and set root password
Mysql > update mysql.user set authentication_string=password ('123456') where user='root'
Query OK, 1 row affected, 1 warning (0.09 sec)
Rows matched: 1 Changed: 1 Warnings: 1
Mysql > exit
Bye
[root@mha ~] # vi / etc/my.cnf # go in and comment on the skip-grant-tables
[root@mha ~] # systemctl restart mysqld
ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.
1. Modify the user's password:
Mysql > alter user 'root'@'localhost' identified by' youpassword'; or set password=password ("xxxxx")
2. Authorize remote access:
Grant permission on. To 'user' @% 'identified by' 123456'
#% represents all addresses; the first is the library, the second is the table
Permissions:
All privileges (all permissions)
Insert,update,delete,select (add, change, delete and check)
3. View the permissions of the user
Select from mysql.user where user='root'\ G
4. Add Chinese character set
Add under [mysqld]
Character_set_server=utf8
5. Through authorization:
Mysql > grant all privileges on zabbix. To 'zabbix'@'localhost' identified by' 123456'
ERROR 1819 (HY000): Your password does not satisfy the current policy requirements
Sometimes, just to test myself, I don't want the password to be set to mysql > so complicated. For example, I just want to set the password for root to 123456.
Two global parameters must be modified:
First, modify the value of the validate_password_policy parameter
Mysql > set global validate_password_policy=0
Query OK, 0 rows affected (0.00 sec)
In this way, the criterion for judging the password is based on the length of the password. This is determined by the validate_password_length parameter.
Mysql > select @ @ validate_password_length
+-+
| | @ @ validate_password_length |
+-+
| | 8 |
+-+
1 row in set (0.00 sec)
The validate_password_length parameter defaults to 8, which is limited by a minimum value of:
Validate_password_number_count
Validate_password_special_char_count (2 * validate_password_mixed_case_count)
Where validate_password_number_count specifies the length of the data in the password, validate_password_special_char_count specifies the length of special characters in the password, and validate_password_mixed_case_count specifies the length of large and small letters in the password.
For these parameters, the default value is 1, so the minimum value of validate_password_length is 4. If you explicitly specify that the value of validate_password_length is less than 4, although there will be no error, the value of validate_password_length will be set to 4. As follows:
Mysql > select @ @ validate_password_length
+-+
| | @ @ validate_password_length |
+-+
| | 8 |
+-+
1 row in set (0.00 sec)
Mysql > set global validate_password_length=1
Query OK, 0 rows affected (0.00 sec)
Mysql > select @ @ validate_password_length
+-+
| | @ @ validate_password_length |
+-+
| | 4 |
+-+
1 row in set (0.00 sec)
If any of the values in the validate_password_number_count,validate_password_special_char_count,validate_password_mixed_case_count are modified, the validate_password_length will be modified dynamically.
Mysql > select @ @ validate_password_length
+-+
| | @ @ validate_password_length |
+-+
| | 4 |
+-+
1 row in set (0.00 sec)
Mysql > select @ @ validate_password_mixed_case_count
+-+
| | @ @ validate_password_mixed_case_count |
+-+
| | 1 |
+-+
1 row in set (0.00 sec)
Mysql > set global validate_password_mixed_case_count=2
Query OK, 0 rows affected (0.00 sec)
Mysql > select @ @ validate_password_mixed_case_count
+-+
| | @ @ validate_password_mixed_case_count |
+-+
| | 2 |
+-+
1 row in set (0.00 sec)
Mysql > select @ @ validate_password_length
+-+
| | @ @ validate_password_length |
+-+
| | 6 |
+-+
1 row in set (0.00 sec)
Https://repo.mysql.com//mysql57-community-release-el7-11.noarch.rpm
Password changed when initializing mysql
5. Allow Zabbix web console to be available for specific IP segments (optional)
Edit file / etc/httpd/conf.d/zabbix.conf
Vi / etc/httpd/conf.d/zabbix.conf
Add an ip segment that allows access to the zabbix web interface. If you set 'Allow from All', this allows all access
#
Zabbix monitoring system php web frontend
#
Alias / zabbix / usr/share/zabbix
Options FollowSymLinks
AllowOverride None
Require all granted
Php_value max_execution_time 300
Php_value memory_limit 128M
Php_value post_max_size 16M
Php_value upload_max_filesize 2M
Php_value max_input_time 300
Php_value date.timezone Asia/Shanghai
Require all denied
Require all denied
Start zabbix-server and zabbix-agent. Restart httpd, and set zabbix-server and zabbix-agent to boot automatically
Systemctl start zabbix-server
Systemctl start zabbix-agent
Systemctl restart httpd
Systemctl restart mariadb
Systemctl enable zabbix-server
Systemctl enable zabbix-agent-(optional)
6. Install and deploy zabbix
Prepare:
Rpm-- import http://repo.zabbix.com/RPM-GPG-KEY-ZABBIX
Rpm-Uv http://repo.zabbix.com/zabbix/2.4/rhel/7/x86_64/zabbix-release-2.4-1.el7.noarch.rpm
Installation:
Yum install zabbix-server-mysql zabbix-web-mysql zabbix-agent zabbix-java-gateway
Deployment:
(1) Edit file / etc/httpd/conf.d/zabbix:
Vi / etc/httpd/conf.d/zabbix.conf
Update time zone:
Php_value date.timezone Asia/Shanghai
Restart httpd
Systemctl restart httpd
(2) create MySQL database and users
Log in to MariaDB:
Mysql-u root-p
Create a database 'zabbixdb' and database users' zabbix'
MariaDB [(none)] > create database zabbix character set utf8
MariaDB [(none)] > grant all privileges on zabbix.* to 'zabbix'@'localhost' identified by' 123456'
MariaDB [(none)] > flush privileges
(3) Import database into zabbix template
Log in to the database using the database user zabbix
Mysql-uzabbix-p
Switch to zabbix database
Use zabbix
Import template data
MariaDB [zabbix] > source / usr/share/doc/zabbix-server-mysql-2.4.8/create/schema.sql
MariaDB [zabbix] > source / usr/share/doc/zabbix-server-mysql-2.4.8/create/images.sql
MariaDB [zabbix] > source / usr/share/doc/zabbix-server-mysql-2.4.8/create/data.sql
(4) configure Zabbix server
Edit file / etc/zabbix/zabbix_server.conf
Vi / etc/zabbix/zabbix_server.conf
Configure the following three parameters
[...]
DBName=zabbix
[...]
DBUser=zabbix
[...]
DBPassword=123456
[...]
(5) configure zabbix-agent
Vi / etc/zabbix/zabbix_agentd.conf
Configure ip for zabbix server
[...]
Line 85-Specify Zabbix server
Server=127.0.0.1
[...]
Line 126-Specify Zabbix server
ServerActive=127.0.0.1
[...]
Line 137-Specify Zabbix server Hostname or IP address
Hostname=127.0.0.1
[...]
(6) modify PHP settings
Modify the settings recommended by php.ini for zabbix
Edit the file php.ini
Vi / etc/php.ini
Set the following parameters.
Max_execution_time = 600,
Max_input_time = 600,
Memory_limit = 256
Mpost_max_size = 32m
Upload_max_filesize = 16m
Date.timezone = Asia/Shanghai
(7) install zabbix on web page
Once the preliminary work is done, it will be all OK.
Default login password and user name for web page, Admin/zabbix
Zabbix Monitoring mysql
The mysql configuration of the zabbix client needs to configure the client:
[client]
# socket=/app/mysql/lib/mysql.sock
Socket=/var/lib/mysql/mysql.sock
User=root
Host=localhost
Password=123456
The zabbix client of mysql correctly customizes key (if the configuration of key:mysql.version mysql.status mysql.ping from Baidu is incorrect and the zabbix-agent service cannot be started, it may be due to the version). The following is the correct configuration:
UnsafeUserParameters=1
UserParameter=version,mysql-V
UserParameter=status [], / etc/zabbix/scripts/check_mysql.sh $1
UserParameter=ping [], mysqladmin-u zabbix-p123456 ping | grep-c alive
Mysql script for zabbix client:
[root@mariadb02 zabbix] # cat scripts/check_mysql.sh
#! / bin/bash
Source / etc/profile
User name
# MYSQL_USER='zabbix'
Password
# MYSQL_PWD='123456'
Host address / IP
# MYSQL_HOST='127.0.0.1'
Port
# MYSQL_PORT='3306'
Data connection
# mysqladmin=/usr/bin/mysqladmin-u$ {MYSQL_USER}-p$ {MYSQL_PWD}-h$ {MYSQL_HOST}-P$ {MYSQL_PORT}
Mysqladmin=which mysqladmin
Case $1 in
Uptime)
Result=$ {mysqladmin} status | cut-f2-d ":" | cut-F1-d "T"
Echo $result
Com_update)
Result=$ {mysqladmin} extended-status | grep-w "Com_update" | cut-d "|"-f3
Echo $result
Slow_queries)
Result=$ {mysqladmin} status | cut-f5-d ":" | cut-F1-d "O"
Echo $result
Com_select)
Result=$ {mysqladmin} extended-status | grep-w "Com_select" | cut-d "|"-f3
Echo $result
Com_rollback)
Result=$ {mysqladmin} extended-status | grep-w "Com_rollback" | cut-d "|"-f3
Echo $result
Questions)
Result=$ {mysqladmin} status | cut-f4-d ":" | cut-F1-d "S"
Echo $result
Com_insert)
Result=$ {mysqladmin} extended-status | grep-w "Com_insert" | cut-d "|"-f3
Echo $result
Com_delete)
Result=$ {mysqladmin} extended-status | grep-w "Com_delete" | cut-d "|"-f3
Echo $result
Com_commit)
Result=$ {mysqladmin} extended-status | grep-w "Com_commit" | cut-d "|"-f3
Echo $result
Bytes_sent)
Result=$ {mysqladmin} extended-status | grep-w "Bytes_sent" | cut-d "|"-f3
Echo $result
Bytes_received)
Result=$ {mysqladmin} extended-status | grep-w "Bytes_received" | cut-d "|"-f3
Echo $result
Com_begin)
Result=$ {mysqladmin} extended-status | grep-w "Com_begin" | cut-d "|"-f3
Echo $result
*) echo "Usage:$0 (Uptime | Com_update | Slow_queries | Com_select | Com_rollback | Questions | Com_insert | Com_delete | Com_commit | Bytes_sent | Bytes_received | Com_begin)"
Esac
Log log of zabbix server
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.