一.前言

​ linux安装软件的方式多种多样,MySQL也不例外,本文将介绍MySQL所有的安装方式。

二.关于MySQL的安装

​ MySQL一般可以采用四种安装方式,每种方式各有优点,使用场景各有不同:

  • yum安装MySQL,优点:简单,方便,适用场景:可以访问网络的环境
  • 离线源码编译安装MySQL,优点:可定制,适用性强,适用场景:无网络,需要定制MySQL,平台兼容性不强(内存最好大于4G不然编译会出现内存不足的报错)
  • RPM包安装MySQL,优点:简单,方便,适用场景:redhat系统
  • 通用二进制包安装MySQL,优点:简单,好维护,适用场景:大部分环境都适用(推荐)

三.部署规划

3.1 服务器规划

服务器操作系统版本CPU架构MySQL安装方式
node6CentOS Linux release 7.4.1708x86_64源码编译安装MySQL
node7CentOS Linux release 7.4.1708x86_64通用二进制包安装MySQL
node8CentOS Linux release 7.4.1708x86_64RPM包安装MySQL
node9CentOS Linux release 7.4.1708x86_64yum安装MySQL

3.2 数据库目录规划

文件类型文件部署位置
数据目录datadir/data/data(/data目录请确保足够大)
配置文件my.cnf/etc/my.cnf
错误日志log-error/data/log/mysql_error.log
二进制日志log-bin/data/binlogs/mysql-bin(用于数据库恢复和主从复制,以及审计(audit)操作)
慢查询日志slow_query_log_file/data/log/mysql_slow_query.log
套接字文件socket/data/run/mysql.sock
进程ID文件mysql.pid/data/run/mysql.pid

四.准备工具

1.MySQL通用二进制包:mysql-5.7.28-linux-glibc2.12-x86_64.tar.gz

下载地址:https://dev.mysql.com/downloads/mysql/5.7.html#downloads

​ 

2.MySQLRPM包:mysql-community-client-5.7.28-1.el7.x86_64.rpm

​ mysql-community-common-5.7.28-1.el7.x86_64.rpm

​ mysql-community-devel-5.7.28-1.el7.x86_64.rpm

​ mysql-community-libs-5.7.28-1.el7.x86_64.rpm

​ mysql-community-libs-compat-5.7.28-1.el7.x86_64.rpm

​ mysql-community-server-5.7.28-1.el7.x86_64.rpm

下载地址:https://dev.mysql.com/downloads/mysql/5.7.html#downloads

1575168892245

3.MySQL源码包:mysql-boost-5.7.28.tar.gz

下载地址:https://dev.mysql.com/downloads/mysql/5.7.html#downloads

1575168777801

4.MySQL的Yum源:mysql57-community-release-el7-10.noarch.rpm

或者mysql-community-release-el7-5.noarch.rpm

下载方法:wget -i -c http://dev.mysql.com/get/mysql57-community-release-el7-10.noarch.rpm

或者wget http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm

五.通用二进制包安装MySQL

5.1 上传MySQL通用二进制安装包到node7的/usr/local/src目录下

[root@node7 src]# pwd
/usr/local/src
[root@node7 src]# ls
mysql-5.7.26-linux-glibc2.12-x86_64.tar.gz

5.2 解压MySQL到指定目录并改名

[root@node7 src]# tar -zxf mysql-5.7.26-linux-glibc2.12-x86_64.tar.gz -C /usr/local/
[root@node7 src]# cd /usr/local/
[root@node7 local]# ls
bin  etc  games  include  lib  lib64  libexec  mysql-5.7.26-linux-glibc2.12-x86_64  sbin  share  src
[root@node7 local]# mv mysql-5.7.26-linux-glibc2.12-x86_64 mysql
[root@node7 local]# ls
bin  etc  games  include  lib  lib64  libexec  mysql  sbin  share  src

5.3 创建MySQL用户和用户组

[root@node7 local]# groupadd -g 1111 mysql
[root@node7 local]# useradd -g mysql -u 1111 -s /sbin/nologin mysql
[root@node7 local]# id mysql    #查看用户信息
uid=1111(mysql) gid=1111(mysql) groups=1111(mysql)

5.4 配置MySQL的bin目录到PATH路径

[root@node7 local]# echo "export PATH=$PATH:/usr/local/mysql/bin" >> /etc/profile
[root@node7 local]# source /etc/profile
[root@node7 local]# mysql    #输入MySQL之后双击tab键,即可列出候选MySQL命令
mysql                       mysql_client_test_embedded  mysqld-debug                mysqldumpslow               mysql_plugin                mysqlslap                   mysql_upgrade
mysqladmin                  mysql_config                mysqld_multi                mysql_embedded              mysqlpump                   mysql_ssl_rsa_setup         mysqlxtest
mysqlbinlog                 mysql_config_editor         mysqld_safe                 mysqlimport                 mysql_secure_installation   mysqltest_embedded          
mysqlcheck                  mysqld                      mysqldump                   mysql_install_db            mysqlshow                   mysql_tzinfo_to_sql

5.5 创建MySQL数据存放目录

[root@node7 ~]# mkdir -p /data/{data,log,binlogs,run}
[root@node7 ~]# tree /data    #如果没有tree命令,则yum -y install tree安装
/data
├── binlogs
├── data
├── log
└── run4 directories, 0 files
[root@node7 ~]# chown -R mysql:mysql /data
[root@node7 ~]# ll /data/
total 0
drwxr-xr-x 2 mysql mysql 6 Dec  3 11:07 binlogs
drwxr-xr-x 2 mysql mysql 6 Dec  3 11:07 data
drwxr-xr-x 2 mysql mysql 6 Dec  3 11:07 log
drwxr-xr-x 2 mysql mysql 6 Dec  3 11:07 run

5.6 配置MySQL配置文件

[root@node7 mysql]# rm -rf /etc/my.cnf
[root@node7 mysql]# touch /etc/my.cnf
#my.cnf配置文件详解,请查看我上一篇blog的#https://www.cnblogs.com/renshengdezheli/p/11913248.html的“MySQL配置文件优化参考”
[root@node7 mysql]# cat /etc/my.cnf
[client]
port=3306
socket=/data/run/mysql.sock[mysqld]
port=3306
socket=/data/run/mysql.sock
pid_file=/data/run/mysql.pid
datadir=/data/data
default_storage_engine=InnoDB
max_allowed_packet=512M
max_connections=2048
open_files_limit=65535skip-name-resolve
lower_case_table_names=1character-set-server=utf8mb4
collation-server=utf8mb4_unicode_ci
init_connect='SET NAMES utf8mb4'innodb_buffer_pool_size=1024M
innodb_log_file_size=2048M
innodb_file_per_table=1
innodb_flush_log_at_trx_commit=0key_buffer_size=64Mlog-error=/data/log/mysql_error.log
log-bin=/data/binlogs/mysql-bin
slow_query_log=1
slow_query_log_file=/data/log/mysql_slow_query.log
long_query_time=5tmp_table_size=32M
max_heap_table_size=32M
query_cache_type=0
query_cache_size=0server-id=1

5.7 初始化MySQL数据库

[root@node7 mysql]# mysqld --initialize --user=mysql --basedir=/usr/local/mysql --datadir=/data/data
[root@node7 mysql]# echo $?
0
[root@node7 mysql]# grep 'temporary password' /data/log/mysql_error.log    #查看MySQL初始化密码
2019-12-03T03:47:42.639938Z 1 [Note] A temporary password is generated for root@localhost: lhrh>J,p<8gw

5.8 生成ssl(可选)

#关于MySQL开启ssl查看https://www.cnblogs.com/mysql-dba/p/7061300.html
[root@node7 mysql]# mysql_ssl_rsa_setup --basedir=/usr/local/mysql --datadir=/data/data
Generating a 2048 bit RSA private key
......................................+++
.+++
writing new private key to 'ca-key.pem'
-----
Generating a 2048 bit RSA private key
....................................+++
............................+++
writing new private key to 'server-key.pem'
-----
Generating a 2048 bit RSA private key
.....................................................................................+++
..............................................+++
writing new private key to 'client-key.pem'
-----
#执行完成之后,会有在datadir目录生成*.pem文件
[root@node7 mysql]# ls /data/data/
auto.cnf    client-cert.pem  ibdata1      mysql               public_key.pem   sys
ca-key.pem  client-key.pem   ib_logfile0  performance_schema  server-cert.pem
ca.pem      ib_buffer_pool   ib_logfile1  private_key.pem     server-key.pem

5.9 配置MySQL启动项并设置开机自启动

5.9.1 centos6版本

cd /usr/local/mysql
cp support-files/mysql.server /etc/init.d/mysql.server
chkconfig --add mysql.server
chkconfig  mysql.server on
chkconfig --list

5.9.2 centos7版本

[root@node7 system]# cd /usr/lib/systemd/system
[root@node7 system]# touch mysqld.service 
[root@node7 system]# vim mysqld.service 
[root@node7 system]# cat mysqld.service 
# Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 2 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
#
# systemd service file for MySQL forking server
#[Unit]
Description=MySQL Server
Documentation=man:mysqld(5.7)
Documentation=http://dev.mysql.com/doc/refman/en/using-systemd.html
After=network.target
After=syslog.target[Install]
WantedBy=multi-user.target[Service]
User=mysql
Group=mysqlType=forkingPIDFile=/data/run/mysql.pid# Disable service start and stop timeout logic of systemd for mysqld service.
TimeoutSec=0# Execute pre and post scripts as root
PermissionsStartOnly=true# Needed to create system tables
#ExecStartPre=/usr/bin/mysqld_pre_systemd# Start main service
ExecStart=/usr/local/mysql/bin/mysqld --daemonize --pid-file=/data/run/mysql.pid $MYSQLD_OPTS# Use this to switch malloc implementation
EnvironmentFile=-/etc/sysconfig/mysql# Sets open_files_limit
LimitNOFILE = 65535Restart=on-failureRestartPreventExitStatus=1PrivateTmp=false[root@node7 system]# systemctl daemon-reload    #重新加载服务配置文件
[root@node7 system]# systemctl enable mysqld    #设置MySQL开机自启动
Created symlink from /etc/systemd/system/multi-user.target.wants/mysqld.service to /usr/lib/systemd/system/mysqld.service.
[root@node7 system]# systemctl is-enabled mysqld   #查看MySQL开机自启动是否设置成功
enabled

5.10 启动MySQL

[root@node7 system]# systemctl start mysqld
[root@node7 system]# systemctl status mysqld    #查看MySQL启动状态
● mysqld.service - MySQL ServerLoaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled)Active: active (running) since Tue 2019-12-03 14:42:14 CST; 9s agoDocs: man:mysqld(5.7)http://dev.mysql.com/doc/refman/en/using-systemd.htmlProcess: 2905 ExecStart=/usr/local/mysql/bin/mysqld --daemonize --pid-file=/data/run/mysql.pid $MYSQLD_OPTS (code=exited, status=0/SUCCESS)Main PID: 2907 (mysqld)CGroup: /system.slice/mysqld.service└─2907 /usr/local/mysql/bin/mysqld --daemonize --pid-file=/data/run/mysql.pidDec 03 14:42:13 node7 systemd[1]: Starting MySQL Server...
Dec 03 14:42:14 node7 systemd[1]: Started MySQL Server.
[root@node7 system]# ps -ef | grep mysql         #查看MySQL进程
mysql      2907      1  2 14:42 ?        00:00:00 /usr/local/mysql/bin/mysqld --daemonize --pid-file=/data/run/mysql.pid
root       2942   2576  0 14:42 pts/0    00:00:00 grep --color=auto mysql

5.11 进行MySQL安全初始化(可选)

[root@node7 system]# mysql_secure_installation Securing the MySQL server deployment.Enter password for user root:    #这里输入MySQL初始化时生成的密码(grep 'temporary password' /data/log/mysql_error.log)The existing password for the user account root has expired. Please set a new password.New password:   #输入新密码Re-enter new password: VALIDATE PASSWORD PLUGIN can be used to test passwords
and improve security. It checks the strength of password
and allows the users to set only those passwords which are
secure enough. Would you like to setup VALIDATE PASSWORD plugin?Press y|Y for Yes, any other key for No: n   #y安装MySQL密码插件
Using existing password for root.
Change the password for root ? ((Press y|Y for Yes, any other key for No) : n... skipping.
By default, a MySQL installation has an anonymous user,
allowing anyone to log into MySQL without having to have
a user account created for them. This is intended only for
testing, and to make the installation go a bit smoother.
You should remove them before moving into a production
environment.Remove anonymous users? (Press y|Y for Yes, any other key for No) : y  #y移除匿名用户
Success.Normally, root should only be allowed to connect from
'localhost'. This ensures that someone cannot guess at
the root password from the network.Disallow root login remotely? (Press y|Y for Yes, any other key for No) : n  #是否允许root远程登录... skipping.
By default, MySQL comes with a database named 'test' that
anyone can access. This is also intended only for testing,
and should be removed before moving into a production
environment.Remove test database and access to it? (Press y|Y for Yes, any other key for No) : y  #是否移除test数据库- Dropping test database...
Success.- Removing privileges on test database...
Success.Reloading the privilege tables will ensure that all changes
made so far will take effect immediately.Reload privilege tables now? (Press y|Y for Yes, any other key for No) : y  #刷新权限表
Success.All done!

5.12 修改密码,给用户赋权限(根据自己情况赋权限)

[root@node7 ~]# mysql -uroot -p111111
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.7.26-log MySQL Community Server (GPL)Copyright (c) 2000, 2019, 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> SET PASSWORD = PASSWORD('123456');#修改root密码为123456,如果提示ERROR 1819 (HY000): Your password does not satisfy the current policy requirements,则说明密码设置太简单,如果想设置123456这样的简单密码,可在SQL中执行:#mysql> set global validate_password_policy=0;#mysql> set global validate_password_length=1;#这样再次执行SET PASSWORD = PASSWORD('123456')就可成功。
Query OK, 0 rows affected, 1 warning (0.01 sec)mysql> UPDATE mysql.user SET authentication_string =PASSWORD('123456') WHERE User='mysql';    #修改MySQL的mysql用户的密码为123456
Query OK, 0 rows affected, 1 warning (0.00 sec)
Rows matched: 0  Changed: 0  Warnings: 1mysql> GRANT ALL PRIVILEGES ON *.* TO mysql@localhost IDENTIFIED BY '123456' WITH GRANT OPTION;   
Query OK, 0 rows affected, 2 warnings (0.00 sec)mysql> GRANT ALL PRIVILEGES ON *.* TO mysql@"%" IDENTIFIED BY '123456' WITH GRANT OPTION;   #赋予mysql用户可以在任何机器上登录,并拥有所有表的所有权限
Query OK, 0 rows affected, 1 warning (0.00 sec)mysql> GRANT ALL PRIVILEGES ON *.* TO root@localhost IDENTIFIED BY '123456' WITH GRANT OPTION;
Query OK, 0 rows affected, 2 warnings (0.00 sec)mysql> GRANT ALL PRIVILEGES ON *.* TO root@"%" IDENTIFIED BY '123456' WITH GRANT OPTION;
Query OK, 0 rows affected, 1 warning (0.07 sec)mysql> FLUSH PRIVILEGES ;   #刷新权限,让修改立即生效
Query OK, 0 rows affected (0.00 sec)mysql> exit;
Bye--------------------------------------------------------------------------------------
#以下是为MySQL赋权限的介绍
mysql> grant 权限1,权限2,…权限n on 数据库名称.表名称 to 用户名@用户地址 identified by ‘连接口令’;
权限1,权限2,…权限n代表select,insert,update,delete,create,drop,index,alter,grant,references,reload,shutdown,process,file等14个权限。
当权限1,权限2,…权限n被all privileges或者all代替,表示赋予用户全部权限。
当数据库名称.表名称被*.*代替,表示赋予用户操作服务器上所有数据库所有表的权限。
用户地址可以是localhost,也可以是ip地址、机器名字、域名。也可以用’%'表示从任何地址连接。
‘连接口令’不能为空,否则创建失败。
比如:
mysql>grant select,insert,update,delete,create,drop on vtdc.employee to joe@10.163.225.87 identified by ‘123′;
给来自10.163.225.87的用户joe分配可对数据库vtdc的employee表进行select,insert,update,delete,create,drop等操作的权限,并设定口令为123。mysql>grant all privileges on vtdc.* to joe@10.163.225.87 identified by ‘123′;
给来自10.163.225.87的用户joe分配可对数据库vtdc所有表进行所有操作的权限,并设定口令为123。
--------------------------------------------------------------------------------------

5.13 导入时区信息到MySQL库

[root@node7 system]# mysql_tzinfo_to_sql /usr/share/zoneinfo | mysql -uroot -p111111 mysql
#执行上述操作之后,time_zone,time_zone_leap_second,time_zone_name,time_zone_transition   ,time_zone_transition_type表就有时区数据了
[root@node7 system]# mysql -uroot -p111111 mysql
mysql> show tables;
+---------------------------+
| Tables_in_mysql           |
+---------------------------+
| columns_priv              |
| db                        |
| engine_cost               |
| event                     |
| func                      |
| general_log               |
| gtid_executed             |
| help_category             |
| help_keyword              |
| help_relation             |
| help_topic                |
| innodb_index_stats        |
| innodb_table_stats        |
| ndb_binlog_index          |
| plugin                    |
| proc                      |
| procs_priv                |
| proxies_priv              |
| server_cost               |
| servers                   |
| slave_master_info         |
| slave_relay_log_info      |
| slave_worker_info         |
| slow_log                  |
| tables_priv               |
| time_zone                 |
| time_zone_leap_second     |
| time_zone_name            |
| time_zone_transition      |
| time_zone_transition_type |
| user                      |
+---------------------------+
31 rows in set (0.00 sec)

5.14 查看MySQL版本信息

[root@node7 system]# mysql -V
mysql  Ver 14.14 Distrib 5.7.26, for linux-glibc2.12 (x86_64) using  EditLine wrapper
[root@node7 system]# mysqladmin version -uroot -p111111
mysqladmin: [Warning] Using a password on the command line interface can be insecure.
mysqladmin  Ver 8.42 Distrib 5.7.26, for linux-glibc2.12 on x86_64
Copyright (c) 2000, 2019, 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.Server version		5.7.26-log
Protocol version	10
Connection		Localhost via UNIX socket
UNIX socket		/data/run/mysql.sock
Uptime:			31 min 53 secThreads: 1  Questions: 8855  Slow queries: 0  Opens: 214  Flush tables: 1  Open tables: 203  Queries per second avg: 4.628

5.15 如果防火墙开着,则需要开放3306端口

[root@node7 system]# systemctl status firewalld
● firewalld.service - firewalld - dynamic firewall daemonLoaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled)Active: active (running) since Tue 2019-12-03 15:22:18 CST; 3s agoDocs: man:firewalld(1)Main PID: 3343 (firewalld)CGroup: /system.slice/firewalld.service└─3343 /usr/bin/python -Es /usr/sbin/firewalld --nofork --nopidDec 03 15:22:17 node7 systemd[1]: Starting firewalld - dynamic firewall daemon...
Dec 03 15:22:18 node7 systemd[1]: Started firewalld - dynamic firewall daemon.
Dec 03 15:22:18 node7 firewalld[3343]: WARNING: ICMP type 'beyond-scope' is not supported by the kernel for ipv6.
Dec 03 15:22:18 node7 firewalld[3343]: WARNING: beyond-scope: INVALID_ICMPTYPE: No supported ICMP type., ignoring...-time.
Dec 03 15:22:18 node7 firewalld[3343]: WARNING: ICMP type 'failed-policy' is not supported by the kernel for ipv6.
Dec 03 15:22:18 node7 firewalld[3343]: WARNING: failed-policy: INVALID_ICMPTYPE: No supported ICMP type., ignorin...-time.
Dec 03 15:22:18 node7 firewalld[3343]: WARNING: ICMP type 'reject-route' is not supported by the kernel for ipv6.
Dec 03 15:22:18 node7 firewalld[3343]: WARNING: reject-route: INVALID_ICMPTYPE: No supported ICMP type., ignoring...-time.
Hint: Some lines were ellipsized, use -l to show in full.
#添加防火墙规则
[root@node7 system]# firewall-cmd --permanent --zone=public --add-port=3306/tcp
success
#重新加载防火墙规则
[root@node7 system]# firewall-cmd --reload
success
#检查规则是否设置生效
[root@node7 system]# firewall-cmd --zone=public --query-port=3306/tcp
yes
#列出防火墙所有开放的端口
[root@node7 system]# firewall-cmd --list-all
public (active)target: defaulticmp-block-inversion: nointerfaces: ens33sources: services: ssh dhcpv6-clientports: 3306/tcpprotocols: masquerade: noforward-ports: source-ports: icmp-blocks: rich rules: 

5.16 利用logrotate对MySQL日志进行轮转(日志自动备份切割)

#logrotate配置详解请查看:https://www.linuxidc.com/Linux/2019-02/157099.htm
[root@node7 ~]# touch /root/.my.cnf
[root@node7 ~]# vim /root/.my.cnf 
[root@node7 ~]# cat /root/.my.cnf 
[mysqladmin]  
password=111111
user=root
[root@node7 ~]# chmod 600 /root/.my.cnf 
[root@node7 ~]# cp /usr/local/mysql/support-files/mysql-log-rotate /etc/logrotate.d/
[root@node7 ~]# chmod 644 /etc/logrotate.d/mysql-log-rotate 
[root@node7 ~]# vim /etc/logrotate.d/mysql-log-rotate 
[root@node7 ~]# cat /etc/logrotate.d/mysql-log-rotate 
# The log file name and location can be set in
# /etc/my.cnf by setting the "log-error" option
# in either [mysqld] or [mysqld_safe] section as
# follows:
#
# [mysqld]
# log-error=/usr/local/mysql/data/mysqld.log
#
# In case the root user has a password, then you
# have to create a /root/.my.cnf configuration file
# with the following content:
#
# [mysqladmin]
# password = <secret> 
# user= root
#
# where "<secret>" is the password. 
#
# ATTENTION: The /root/.my.cnf file should be readable
# _ONLY_ by root !/data/log/mysql_*.log {# create 600 mysql mysqlnotifempty  #当日志文件为空时,不进行轮转daily  #默认每一天执行一次rotate轮转工作rotate 52  #保留多少个日志文件(轮转几次).默认保留四个.就是指定日志文件删除之前轮转的次数,0 指没有备份,此处表示保留52天的日志missingok   #如果日志文件丢失,不要显示错误compress    #通过gzip 压缩转储以后的日志postrotate   #执行的指令# just if mysqld is really runningif test -x /usr/local/mysql/bin/mysqladmin && \/usr/local/mysql/bin/mysqladmin ping &>/dev/nullthen/usr/local/mysql/bin/mysqladmin flush-logsfiendscript
}
[root@node7 ~]# 
[root@node7 ~]# logrotate -fv /etc/logrotate.d/mysql-log-rotate #强制进行日志轮转
reading config file /etc/logrotate.d/mysql-log-rotate
Allocating hash table for state file, size 15360 BHandling 1 logsrotating pattern: /data/log/mysql_*.log  forced from command line (52 rotations)
empty log files are not rotated, old logs are removed
considering log /data/log/mysql_error.loglog needs rotating
considering log /data/log/mysql_slow_query.loglog needs rotating
rotating log /data/log/mysql_error.log, log->rotateCount is 52
dateext suffix '-20191203'
glob pattern '-[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]'
renaming /data/log/mysql_error.log.52.gz to /data/log/mysql_error.log.53.gz 
(t -- won't try to dispose of it
.................
renaming /data/log/mysql_slow_query.log to /data/log/mysql_slow_query.log.1
running postrotate script
compressing log with: /bin/gzip
[root@node7 ~]# 
[root@node7 ~]# echo $?
0
#此时查看日志目录,发现日志已经进行轮转,并压缩
[root@node7 ~]# ls /data/log/
mysql_error.log  mysql_error.log.1.gz  mysql_slow_query.log  mysql_slow_query.log.1.gz

自此,通用二进制包安装MySQL完毕

六.使用RPM包安装MySQL

6.1 上传MySQL的RPM包到/usr/local/src目录下

[root@node8 local]# cd /usr/local/src/
[root@node8 src]# ls
mysql-community-client-5.7.23-1.el7.x86_64.rpm  mysql-community-libs-5.7.23-1.el7.x86_64.rpm
mysql-community-common-5.7.23-1.el7.x86_64.rpm  mysql-community-libs-compat-5.7.23-1.el7.x86_64.rpm
mysql-community-devel-5.7.23-1.el7.x86_64.rpm   mysql-community-server-5.7.23-1.el7.x86_64.rpm

6.2 安装RPM包

[root@node8 src]# rpm -ivh ./*.rpm
warning: ./mysql-community-client-5.7.23-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
error: Failed dependencies:mariadb-libs is obsoleted by mysql-community-libs-5.7.23-1.el7.x86_64mariadb-libs is obsoleted by mysql-community-libs-compat-5.7.23-1.el7.x86_64
#出现上述错误说明:和mariadb-libs组件冲突,卸载mariadb-libs相关组件即可
[root@node8 src]# rpm -qa | grep mariadb*    #查看mariadb-libs相关的组件
mariadb-libs-5.5.56-2.el7.x86_64
[root@node8 src]# rpm -e --nodeps mariadb-libs-5.5.56-2.el7.x86_64 #卸载mariadb-libs组件
warning: /etc/my.cnf saved as /etc/my.cnf.rpmsave
[root@node8 src]# rpm -ivh ./*.rpm
warning: ./mysql-community-client-5.7.23-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing...                          ################################# [100%]
Updating / installing...1:mysql-community-common-5.7.23-1.e################################# [ 17%]2:mysql-community-libs-5.7.23-1.el7################################# [ 33%]3:mysql-community-client-5.7.23-1.e################################# [ 50%]4:mysql-community-server-5.7.23-1.e################################# [ 67%]5:mysql-community-devel-5.7.23-1.el################################# [ 83%]6:mysql-community-libs-compat-5.7.2################################# [100%]
#此时RPM包安装完毕

6.3 启动MySQL,修改密码,为用户赋权

[root@node8 src]# service mysqld status
Redirecting to /bin/systemctl status mysqld.service
● mysqld.service - MySQL ServerLoaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled)Active: inactive (dead)Docs: man:mysqld(8)http://dev.mysql.com/doc/refman/en/using-systemd.html
[root@node8 src]# service mysqld start
Redirecting to /bin/systemctl start mysqld.service
[root@node8 src]# grep password /var/log/mysqld.log 
2019-12-03T10:16:32.931929Z 1 [Note] A temporary password is generated for root@localhost: 3yGgt,Eipr%z
[root@node8 src]# 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.23Copyright (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> SET PASSWORD = PASSWORD('123456');#修改root密码为123456,如果提示ERROR 1819 (HY000): Your password does not satisfy the current policy requirements,则说明密码设置太简单,如果想设置123456这样的简单密码,可在SQL中执行:#mysql> set global validate_password_policy=0;#mysql> set global validate_password_length=1;#这样再次执行SET PASSWORD = PASSWORD('123456')就可成功。
Query OK, 0 rows affected, 1 warning (0.01 sec)mysql> UPDATE mysql.user SET authentication_string =PASSWORD('123456') WHERE User='mysql';    #修改MySQL的mysql用户的密码为123456
Query OK, 0 rows affected, 1 warning (0.00 sec)
Rows matched: 0  Changed: 0  Warnings: 1mysql> GRANT ALL PRIVILEGES ON *.* TO mysql@localhost IDENTIFIED BY '123456' WITH GRANT OPTION;   
Query OK, 0 rows affected, 2 warnings (0.00 sec)mysql> GRANT ALL PRIVILEGES ON *.* TO mysql@"%" IDENTIFIED BY '123456' WITH GRANT OPTION;   #赋予mysql用户可以在任何机器上登录,并拥有所有表的所有权限
Query OK, 0 rows affected, 1 warning (0.00 sec)mysql> GRANT ALL PRIVILEGES ON *.* TO root@localhost IDENTIFIED BY '123456' WITH GRANT OPTION;
Query OK, 0 rows affected, 2 warnings (0.00 sec)mysql> GRANT ALL PRIVILEGES ON *.* TO root@"%" IDENTIFIED BY '123456' WITH GRANT OPTION;
Query OK, 0 rows affected, 1 warning (0.07 sec)mysql> FLUSH PRIVILEGES ;   #刷新权限,让修改立即生效
Query OK, 0 rows affected (0.00 sec)mysql> exit;
Bye--------------------------------------------------------------------------------------
#以下是为MySQL赋权限的介绍
mysql> grant 权限1,权限2,…权限n on 数据库名称.表名称 to 用户名@用户地址 identified by ‘连接口令’;
权限1,权限2,…权限n代表select,insert,update,delete,create,drop,index,alter,grant,references,reload,shutdown,process,file等14个权限。
当权限1,权限2,…权限n被all privileges或者all代替,表示赋予用户全部权限。
当数据库名称.表名称被*.*代替,表示赋予用户操作服务器上所有数据库所有表的权限。
用户地址可以是localhost,也可以是ip地址、机器名字、域名。也可以用’%'表示从任何地址连接。
‘连接口令’不能为空,否则创建失败。
比如:
mysql>grant select,insert,update,delete,create,drop on vtdc.employee to joe@10.163.225.87 identified by ‘123′;
给来自10.163.225.87的用户joe分配可对数据库vtdc的employee表进行select,insert,update,delete,create,drop等操作的权限,并设定口令为123。mysql>grant all privileges on vtdc.* to joe@10.163.225.87 identified by ‘123′;
给来自10.163.225.87的用户joe分配可对数据库vtdc所有表进行所有操作的权限,并设定口令为123。
--------------------------------------------------------------------------------------

自此MySQL的RPM安装就完毕了,此方法自动生成/etc/my.cnf,查看配置文件可知道MySQL的日志目录和数据目录

七.使用yum安装MySQL

7.1 下载并安装MySQL官方的 Yum Repository

[root@node9 ~]# wget -i -c http://dev.mysql.com/get/mysql57-community-release-el7-10.noarch.rpm
--2019-12-03 23:23:44--  http://dev.mysql.com/get/mysql57-community-release-el7-10.noarch.rpm
Resolving dev.mysql.com (dev.mysql.com)... 137.254.60.11
Connecting to dev.mysql.com (dev.mysql.com)|137.254.60.11|:80... connected.
HTTP request sent, awaiting response... 301 Moved Permanently
Location: https://dev.mysql.com/get/mysql57-community-release-el7-10.noarch.rpm [following]
--2019-12-03 23:23:57--  https://dev.mysql.com/get/mysql57-community-release-el7-10.noarch.rpm
Connecting to dev.mysql.com (dev.mysql.com)|137.254.60.11|:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: https://repo.mysql.com//mysql57-community-release-el7-10.noarch.rpm [following]
--2019-12-03 23:24:00--  https://repo.mysql.com//mysql57-community-release-el7-10.noarch.rpm
Resolving repo.mysql.com (repo.mysql.com)... 184.29.107.217
Connecting to repo.mysql.com (repo.mysql.com)|184.29.107.217|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 25548 (25K) [application/x-redhat-package-manager]
Saving to: ‘mysql57-community-release-el7-10.noarch.rpm’100%[================================================================================>] 25,548      21.5KB/s   in 1.2s   2019-12-03 23:24:03 (21.5 KB/s) - ‘mysql57-community-release-el7-10.noarch.rpm’ saved [25548/25548]-c: No such file or directory
No URLs found in -c.
FINISHED --2019-12-03 23:24:03--
Total wall clock time: 19s
Downloaded: 1 files, 25K in 1.2s (21.5 KB/s)[root@node9 ~]# yum -y install mysql57-community-release-el7-10.noarch.rpm 
Loaded plugins: fastestmirror
Examining mysql57-community-release-el7-10.noarch.rpm: mysql57-community-release-el7-10.noarch
Marking mysql57-community-release-el7-10.noarch.rpm to be installed
Resolving Dependencies
--> Running transaction check
---> Package mysql57-community-release.noarch 0:el7-10 will be installed
--> Finished Dependency ResolutionDependencies Resolved==========================================================================================================================Package                           Arch           Version          Repository                                        Size
==========================================================================================================================
Installing:mysql57-community-release         noarch         el7-10           /mysql57-community-release-el7-10.noarch          30 kTransaction Summary
==========================================================================================================================
Install  1 PackageTotal size: 30 k
Installed size: 30 k
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transactionInstalling : mysql57-community-release-el7-10.noarch                                                                1/1 Verifying  : mysql57-community-release-el7-10.noarch                                                                1/1 Installed:mysql57-community-release.noarch 0:el7-10                                                                               Complete!

7.2 安装MySQL-server

#yum安装MySQL会自动解决依赖,一条命令即可,但是需要网络访问权限
[root@node9 ~]# yum -y install mysql-community-server 
.....Installed:mysql-community-libs.x86_64 0:5.7.28-1.el7                mysql-community-libs-compat.x86_64 0:5.7.28-1.el7             mysql-community-server.x86_64 0:5.7.28-1.el7             Dependency Installed:mysql-community-client.x86_64 0:5.7.28-1.el7                mysql-community-common.x86_64 0:5.7.28-1.el7               Replaced:mariadb-libs.x86_64 1:5.5.56-2.el7                                                                                      Complete!

7.3 启动MySQL,查看MySQL初始化密码

[root@node9 ~]# systemctl start mysqld
[root@node9 ~]# systemctl status mysqld
● mysqld.service - MySQL ServerLoaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled)Active: active (running) since Wed 2019-12-04 10:22:00 CST; 1min 22s agoDocs: man:mysqld(8)http://dev.mysql.com/doc/refman/en/using-systemd.htmlProcess: 15965 ExecStart=/usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pid $MYSQLD_OPTS (code=exited, status=0/SUCCESS)Process: 15947 ExecStartPre=/usr/bin/mysqld_pre_systemd (code=exited, status=0/SUCCESS)Main PID: 15968 (mysqld)CGroup: /system.slice/mysqld.service└─15968 /usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pidDec 04 10:22:00 node9 mysqld[15965]: 2019-12-04T02:22:00.774472Z 0 [Warning] CA certificate ca.pem is self signed.
Dec 04 10:22:00 node9 mysqld[15965]: 2019-12-04T02:22:00.774677Z 0 [Note] Skipping generation of RSA key pair as ...ctory.
Dec 04 10:22:00 node9 mysqld[15965]: 2019-12-04T02:22:00.774897Z 0 [Note] Server hostname (bind-address): '*'; port: 3306
Dec 04 10:22:00 node9 mysqld[15965]: 2019-12-04T02:22:00.774962Z 0 [Note] IPv6 is available.
Dec 04 10:22:00 node9 mysqld[15965]: 2019-12-04T02:22:00.774980Z 0 [Note]   - '::' resolves to '::';
Dec 04 10:22:00 node9 mysqld[15965]: 2019-12-04T02:22:00.775003Z 0 [Note] Server socket created on IP: '::'.
Dec 04 10:22:00 node9 mysqld[15965]: 2019-12-04T02:22:00.791933Z 0 [Note] Event Scheduler: Loaded 0 events
Dec 04 10:22:00 node9 mysqld[15965]: 2019-12-04T02:22:00.792180Z 0 [Note] /usr/sbin/mysqld: ready for connections.
Dec 04 10:22:00 node9 mysqld[15965]: Version: '5.7.28'  socket: '/var/lib/mysql/mysql.sock'  port: 3306  MySQL Co... (GPL)
Dec 04 10:22:00 node9 systemd[1]: Started MySQL Server.
Hint: Some lines were ellipsized, use -l to show in full.[root@node9 ~]# grep "password" /var/log/mysqld.log   #查看MySQL初始化密码
2019-11-05T06:35:28.565529Z 1 [Note] A temporary password is generated for root@localhost: T<&loC3=%t+Q

7.4 修改MySQL的root密码,并给用户赋权限

mysql>ALTER USER 'root'@'localhost' IDENTIFIED BY 'new password';mysql> SET PASSWORD = PASSWORD('123456');#修改root密码为123456,如果提示ERROR 1819 (HY000): Your password does not satisfy the current policy requirements,则说明密码设置太简单,如果想设置123456这样的简单密码,可在SQL中执行:#mysql> set global validate_password_policy=0;#mysql> set global validate_password_length=1;#这样再次执行SET PASSWORD = PASSWORD('123456')就可成功。
Query OK, 0 rows affected, 1 warning (0.01 sec)mysql> UPDATE mysql.user SET authentication_string =PASSWORD('123456') WHERE User='mysql';    #修改MySQL的mysql用户的密码为123456
Query OK, 0 rows affected, 1 warning (0.00 sec)
Rows matched: 0  Changed: 0  Warnings: 1mysql> GRANT ALL PRIVILEGES ON *.* TO mysql@localhost IDENTIFIED BY '123456' WITH GRANT OPTION;   
Query OK, 0 rows affected, 2 warnings (0.00 sec)mysql> GRANT ALL PRIVILEGES ON *.* TO mysql@"%" IDENTIFIED BY '123456' WITH GRANT OPTION;   #赋予mysql用户可以在任何机器上登录,并拥有所有表的所有权限
Query OK, 0 rows affected, 1 warning (0.00 sec)mysql> GRANT ALL PRIVILEGES ON *.* TO root@localhost IDENTIFIED BY '123456' WITH GRANT OPTION;
Query OK, 0 rows affected, 2 warnings (0.00 sec)mysql> GRANT ALL PRIVILEGES ON *.* TO root@"%" IDENTIFIED BY '123456' WITH GRANT OPTION;
Query OK, 0 rows affected, 1 warning (0.07 sec)mysql> FLUSH PRIVILEGES ;   #刷新权限,让修改立即生效
Query OK, 0 rows affected (0.00 sec)mysql> exit;
Bye--------------------------------------------------------------------------------------
#以下是为MySQL赋权限的介绍
mysql> grant 权限1,权限2,…权限n on 数据库名称.表名称 to 用户名@用户地址 identified by ‘连接口令’;
权限1,权限2,…权限n代表select,insert,update,delete,create,drop,index,alter,grant,references,reload,shutdown,process,file等14个权限。
当权限1,权限2,…权限n被all privileges或者all代替,表示赋予用户全部权限。
当数据库名称.表名称被*.*代替,表示赋予用户操作服务器上所有数据库所有表的权限。
用户地址可以是localhost,也可以是ip地址、机器名字、域名。也可以用’%'表示从任何地址连接。
‘连接口令’不能为空,否则创建失败。
比如:
mysql>grant select,insert,update,delete,create,drop on vtdc.employee to joe@10.163.225.87 identified by ‘123′;
给来自10.163.225.87的用户joe分配可对数据库vtdc的employee表进行select,insert,update,delete,create,drop等操作的权限,并设定口令为123。mysql>grant all privileges on vtdc.* to joe@10.163.225.87 identified by ‘123′;
给来自10.163.225.87的用户joe分配可对数据库vtdc所有表进行所有操作的权限,并设定口令为123。
--------------------------------------------------------------------------------------

7.5 卸载Yum Repository

#由于安装了Yum Repository,所以每次yum操作都会自动更新,需要把这个卸载掉
[root@node9 ~]# yum -y remove mysql57-community-release-el7-10.noarch
Loaded plugins: fastestmirror
Resolving Dependencies
--> Running transaction check
---> Package mysql57-community-release.noarch 0:el7-10 will be erased
--> Finished Dependency ResolutionDependencies Resolved==========================================================================================================================Package                                   Arch                   Version                 Repository                 Size
==========================================================================================================================
Removing:mysql57-community-release                 noarch                 el7-10                  installed                  30 kTransaction Summary
==========================================================================================================================
Remove  1 PackageInstalled size: 30 k
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transactionErasing    : mysql57-community-release-el7-10.noarch                                                                1/1 Verifying  : mysql57-community-release-el7-10.noarch                                                                1/1 Removed:mysql57-community-release.noarch 0:el7-10                                                                 
Complete!

自此,yum安装MySQL完毕

查看全文
如若内容造成侵权/违法违规/事实不符,请联系编程学习网邮箱:809451989@qq.com进行投诉反馈,一经查实,立即删除!

相关文章

  1. ArchLinux安装VMWare WorkStation

    ArchLinux安装VMWare WorkStation 1.问题描述: Could not open /dev/vmmon: ???. Please make sure that the kernel module `vmmon’ is loaded.查看内核 $ uname -r安装 linux-headers $ sudo pacman -S linux-headers-x 按tab键查看加载内核模块 $ sudo modprobe -a vmw_…...

    2024/5/5 8:21:50
  2. win10系统使用自带的win7图片查看器

    把下面代码复制到txt,重新更改后缀bat,然后鼠标右键,以管理员身份运行即可@echo off&cd\&color 0a&clsecho 恢复Win7照片查看器reg add "HKLM\SOFTWARE\Microsoft\Windows Photo Viewer\Capabilities\FileAssociations" /v ".jpg" /t REG_S…...

    2024/4/14 18:02:30
  3. JAVA在语言级支持多线程

    进程:任务 任务并发执行是一个宏观概念,微观上是串行的。 进程的调度是有OS负责的(有的系统为独占式,有的系统为共享式,根据重要性,进程有优先级)。 由OS将时间分为若干个时间片。 JAVA在语言级支持多线程。 分配时间的仍然是OS。 package TomTexts;public class TomTex…...

    2024/4/8 15:54:46
  4. 微信小程序现金红包返回“IP地址非你在商户平台设置的可用IP地址”错误终极解决方法

    百度搜了一下,没有根本解决方法(前提是在商户平台已经设置了允许的IP),就是提示IP地址非你在...的错误提示,PS:鄙视一下腾讯,既然你都知道我IP是什么,为什么你返回信息不直接告诉我真实IP地址。也有相类似的解决方法:可实际这个IP也不是我的真实IP,因为做了虚拟路由或…...

    2024/4/23 20:36:35
  5. 虚拟内存管理

    定义 虚拟内存是计算机系统内存管理的一种技术。它使得应用程序认为它拥有连续的可用的内存(一个连续完整的地址空间),而实际上,它通常是被分隔成多个物理内存碎片,还有部分暂时存储在外部磁盘存储器上,在需要时进行数据交换。 我的理解 进程实例在用户态并不直接操作物理…...

    2024/4/8 7:05:44
  6. 结构化元素cv2.getStructuringElement()

    目标:了解结构化元素 cv2.getStructuringElement()原理:结构化元素:cv2.getStructuringElement()在前面的图像处理 for Python之形态学转换中,我们使用Numpy(kernel = np.ones((5,5),np.uint8)),构建了结构化元素,它是正方形的。但是有时我们构建一个椭圆形/圆形的核,…...

    2024/4/8 7:04:56
  7. C程序设计第五版1.5练习

    编写一个C程序,运行时输出以下图形。**************** #include <stdio.h> int main() {for (int i = 0; i < 4; i++){for (int j = 0; j < i*2; j++)printf(" ");printf("*****\n");}return 0; }...

    2024/4/23 10:38:39
  8. IDEA中如何使用debug调试项目

    在现在的开发中,我们经常采用Debug来追踪代码的运行流程,通常在程序运行过程中出现异常,启用Debug模式可以分析定位异常发生的位置,以及在运行过程中参数的变化。通常我们也可以启用Debug模式来跟踪代码的运行流程去学习三方框架的源码。所以学习下如何在Intellij IDEA中使…...

    2024/4/17 13:34:09
  9. 条件循环结构

    1.学习内容 1.条件语句包括if语句、if-else语句和if-elif-else语句。 2.循环语句包括while循环、while-else循环、for循环和for-else循环。 3.range()函数和enumerate()函数的使用。 4.break语句可以跳出当前所在层的循环。 5.continue语句可以终止本轮循环并开始下一轮循环…...

    2024/4/19 22:42:06
  10. jar包开机自启脚本的编写

    **1.**将要启动的java项目打成可执行的jar包 **2.**编写一个XXX.bat文件,内容如下:@echo offjava -jar -Xms4000m -Xmx4000m -Xmn2000m C:\Users\Administrator\Desktop\ceshi.jar@pause注;C:\Users\Administrator\Desktop\ceshi.jar 路径为jar包所在的路径 **3.**编写一个…...

    2024/4/30 13:38:02
  11. JVM系列之:Contend注解和false-sharing真的很牛逼!

    简介 现代CPU为了提升性能都会有自己的缓存结构,而多核CPU为了同时正常工作,引入了MESI,作为CPU缓存之间同步的协议。MESI虽然很好,但是不当的时候用也可能导致性能的退化。 到底怎么回事呢?一起来看看吧。 false-sharing的由来 为了提升处理速度,CPU引入了缓存的概念,我…...

    2024/5/1 10:11:56
  12. 一个线程可以拿到多个锁标记,一个对象最多只能将monitor给一个线程

    当用Synchronized修饰某个方法的时候,表示该方法都对当前对象加锁。 给方法加Synchronized和用Synchronized修饰对象的效果是一致的。 一个线程可以拿到多个锁标记,一个对象最多只能将monitor给一个线程。 Synchronized是以牺牲程序运行的效率为代价的,因此应该尽量控制互斥…...

    2024/4/20 14:39:15
  13. 【篡改检测 2】ManTra-Net: Manipulation Tracing Network For Detection And Localization

    前言 《ManTra-Net: Manipulation Tracing Network For Detection And Localization of Image Forgeries With Anomalous Features》 是sponsored by the Defense Advanced Research Projects Agency under agreement num- ber FA8750-16-2-0204 一作是中国人,但是在为美国干事…...

    2024/4/22 5:14:41
  14. bootstrap insertRow后getData数据为空

    insertRow方法新增一行后,getData方法获取表格数据时,新增的一行数据都是空的,解决办法:getData前,先更新一下表格数据:function editColumn() {var count = $("#table").bootstrapTable(getData).length;var params = new Array();for (var dataIndex = 0; da…...

    2024/4/28 17:19:15
  15. [网鼎杯 2020 玄武组]SSRFMe

    平台:buuoj.cn 直接给出源码 <?php function check_inner_ip($url) {$match_result=preg_match(/^(http|https|gopher|dict)?:\/\/.*(\/)?.*$/,$url);if (!$match_result){die(url fomat error);}try{$url_parse=parse_url($url);}catch(Exception $e){die(url fomat er…...

    2024/4/23 8:35:50
  16. 箭头函数

    // 声明一个函数let es5 = function(){}let es6 = (a,b) => {return a + b;}// 调用函数let res = es6(1,2);// console.log(res)// 1.this是静态的,this始终指向函数声明时// 所在作用域下的this的值function getName(){console.log(this.name);}let getName2 = () => …...

    2024/4/19 23:08:53
  17. Oracle数据库管理每周一例(12.2,18c,19c) 2020-07-23

    Oracle数据库管理每周一例(12.2,18c,19c) 2020-07-23第八期 记一次HPUX到Exadata的xtts数据迁移——实战篇1.全量备份与应用2.增量备份与应用3.最终增量备份与应用4.用户元数据导出与导入5.表空间元数据导出与导入6.数据检查及及时问题处理7.后续问题处理下期预告: 第八期 记…...

    2024/4/9 1:57:35
  18. C# 读取oracle 中文乱码的解决方案

    C# 读取oracle 中文乱码的解决方案参考文章: (1)C# 读取oracle 中文乱码的解决方案 (2)https://www.cnblogs.com/moonlight-zjb/p/4718855.html 备忘一下。...

    2024/4/9 1:57:35
  19. JVM必知必会

    JVM---JAVA虚拟机类的加载加载器类的生命周期双亲委派模型(Parents Delegation Model)运行时数据区线程共享方法区(Method Area)/非堆(Non-Heap)堆(heap)线程私有JVM虚拟机栈(Java Virtual Machine Stacks)本地方法栈(Native Method Stack)程序计数器(Program Cou…...

    2024/4/22 8:57:38
  20. LEETCODE刷题记录----------暑假篇

    栈① 删除最外层的括号 ① 删除最外层的括号 题目如下;下面展示 代码。 // 栈string removeOuterParentheses(string S) {stack<char> s;string s1;int left,right;for(int i=0;i<S.length();i++){ if(S[i] == (){if(s.empty())left = i;s.push((); //压入栈}e…...

    2024/4/22 11:59:45

最新文章

  1. 五一玩狗“丧志”记

    我天生喜欢狗狗。五一来到媳妇老家这几天&#xff0c;只要有机会我都要给一个只叫“瘦瘦”的狗狗多攒一些吃的。 它是一条看家狗&#xff0c;有大人膝盖那么高八十厘米那么长。通体毛色以黄黑为主&#xff0c;少许白色主要集中在爪子和下巴。两耳直挺挺尖尖的竖立着&#xff0c…...

    2024/5/5 18:17:43
  2. 梯度消失和梯度爆炸的一些处理方法

    在这里是记录一下梯度消失或梯度爆炸的一些处理技巧。全当学习总结了如有错误还请留言&#xff0c;在此感激不尽。 权重和梯度的更新公式如下&#xff1a; w w − η ⋅ ∇ w w w - \eta \cdot \nabla w ww−η⋅∇w 个人通俗的理解梯度消失就是网络模型在反向求导的时候出…...

    2024/3/20 10:50:27
  3. 分享一个Python爬虫入门实例(有源码,学习使用)

    一、爬虫基础知识 Python爬虫是一种使用Python编程语言实现的自动化获取网页数据的技术。它广泛应用于数据采集、数据分析、网络监测等领域。以下是对Python爬虫的详细介绍: 架构和组成:下载器:负责根据指定的URL下载网页内容,常用的库有Requests和urllib。解析器:用于解…...

    2024/5/5 7:27:13
  4. audio_video_img图片音视频异步可视化加载

    最近在做即时消息&#xff0c;消息类型除了文字还有音频、视频、图片展示&#xff0c;如果消息很多&#xff0c;在切换聊天框时&#xff0c;会有明显卡顿&#xff0c;后续做了懒加载&#xff0c;方案是只加载用户能看到的资源&#xff0c;看不到的先不加载&#xff1b; LazyAud…...

    2024/5/5 8:52:52
  5. 416. 分割等和子集问题(动态规划)

    题目 题解 class Solution:def canPartition(self, nums: List[int]) -> bool:# badcaseif not nums:return True# 不能被2整除if sum(nums) % 2 ! 0:return False# 状态定义&#xff1a;dp[i][j]表示当背包容量为j&#xff0c;用前i个物品是否正好可以将背包填满&#xff…...

    2024/5/4 12:05:22
  6. 【Java】ExcelWriter自适应宽度工具类(支持中文)

    工具类 import org.apache.poi.ss.usermodel.Cell; import org.apache.poi.ss.usermodel.CellType; import org.apache.poi.ss.usermodel.Row; import org.apache.poi.ss.usermodel.Sheet;/*** Excel工具类** author xiaoming* date 2023/11/17 10:40*/ public class ExcelUti…...

    2024/5/5 12:22:20
  7. Spring cloud负载均衡@LoadBalanced LoadBalancerClient

    LoadBalance vs Ribbon 由于Spring cloud2020之后移除了Ribbon&#xff0c;直接使用Spring Cloud LoadBalancer作为客户端负载均衡组件&#xff0c;我们讨论Spring负载均衡以Spring Cloud2020之后版本为主&#xff0c;学习Spring Cloud LoadBalance&#xff0c;暂不讨论Ribbon…...

    2024/5/4 14:46:16
  8. TSINGSEE青犀AI智能分析+视频监控工业园区周界安全防范方案

    一、背景需求分析 在工业产业园、化工园或生产制造园区中&#xff0c;周界防范意义重大&#xff0c;对园区的安全起到重要的作用。常规的安防方式是采用人员巡查&#xff0c;人力投入成本大而且效率低。周界一旦被破坏或入侵&#xff0c;会影响园区人员和资产安全&#xff0c;…...

    2024/5/4 23:54:44
  9. VB.net WebBrowser网页元素抓取分析方法

    在用WebBrowser编程实现网页操作自动化时&#xff0c;常要分析网页Html&#xff0c;例如网页在加载数据时&#xff0c;常会显示“系统处理中&#xff0c;请稍候..”&#xff0c;我们需要在数据加载完成后才能继续下一步操作&#xff0c;如何抓取这个信息的网页html元素变化&…...

    2024/5/5 15:25:47
  10. 【Objective-C】Objective-C汇总

    方法定义 参考&#xff1a;https://www.yiibai.com/objective_c/objective_c_functions.html Objective-C编程语言中方法定义的一般形式如下 - (return_type) method_name:( argumentType1 )argumentName1 joiningArgument2:( argumentType2 )argumentName2 ... joiningArgu…...

    2024/5/4 23:54:49
  11. 【洛谷算法题】P5713-洛谷团队系统【入门2分支结构】

    &#x1f468;‍&#x1f4bb;博客主页&#xff1a;花无缺 欢迎 点赞&#x1f44d; 收藏⭐ 留言&#x1f4dd; 加关注✅! 本文由 花无缺 原创 收录于专栏 【洛谷算法题】 文章目录 【洛谷算法题】P5713-洛谷团队系统【入门2分支结构】&#x1f30f;题目描述&#x1f30f;输入格…...

    2024/5/4 23:54:44
  12. 【ES6.0】- 扩展运算符(...)

    【ES6.0】- 扩展运算符... 文章目录 【ES6.0】- 扩展运算符...一、概述二、拷贝数组对象三、合并操作四、参数传递五、数组去重六、字符串转字符数组七、NodeList转数组八、解构变量九、打印日志十、总结 一、概述 **扩展运算符(...)**允许一个表达式在期望多个参数&#xff0…...

    2024/5/4 14:46:12
  13. 摩根看好的前智能硬件头部品牌双11交易数据极度异常!——是模式创新还是饮鸩止渴?

    文 | 螳螂观察 作者 | 李燃 双11狂欢已落下帷幕&#xff0c;各大品牌纷纷晒出优异的成绩单&#xff0c;摩根士丹利投资的智能硬件头部品牌凯迪仕也不例外。然而有爆料称&#xff0c;在自媒体平台发布霸榜各大榜单喜讯的凯迪仕智能锁&#xff0c;多个平台数据都表现出极度异常…...

    2024/5/4 14:46:11
  14. Go语言常用命令详解(二)

    文章目录 前言常用命令go bug示例参数说明 go doc示例参数说明 go env示例 go fix示例 go fmt示例 go generate示例 总结写在最后 前言 接着上一篇继续介绍Go语言的常用命令 常用命令 以下是一些常用的Go命令&#xff0c;这些命令可以帮助您在Go开发中进行编译、测试、运行和…...

    2024/5/4 14:46:11
  15. 用欧拉路径判断图同构推出reverse合法性:1116T4

    http://cplusoj.com/d/senior/p/SS231116D 假设我们要把 a a a 变成 b b b&#xff0c;我们在 a i a_i ai​ 和 a i 1 a_{i1} ai1​ 之间连边&#xff0c; b b b 同理&#xff0c;则 a a a 能变成 b b b 的充要条件是两图 A , B A,B A,B 同构。 必要性显然&#xff0…...

    2024/5/5 2:25:33
  16. 【NGINX--1】基础知识

    1、在 Debian/Ubuntu 上安装 NGINX 在 Debian 或 Ubuntu 机器上安装 NGINX 开源版。 更新已配置源的软件包信息&#xff0c;并安装一些有助于配置官方 NGINX 软件包仓库的软件包&#xff1a; apt-get update apt install -y curl gnupg2 ca-certificates lsb-release debian-…...

    2024/5/4 21:24:42
  17. Hive默认分割符、存储格式与数据压缩

    目录 1、Hive默认分割符2、Hive存储格式3、Hive数据压缩 1、Hive默认分割符 Hive创建表时指定的行受限&#xff08;ROW FORMAT&#xff09;配置标准HQL为&#xff1a; ... ROW FORMAT DELIMITED FIELDS TERMINATED BY \u0001 COLLECTION ITEMS TERMINATED BY , MAP KEYS TERMI…...

    2024/5/5 13:14:22
  18. 【论文阅读】MAG:一种用于航天器遥测数据中有效异常检测的新方法

    文章目录 摘要1 引言2 问题描述3 拟议框架4 所提出方法的细节A.数据预处理B.变量相关分析C.MAG模型D.异常分数 5 实验A.数据集和性能指标B.实验设置与平台C.结果和比较 6 结论 摘要 异常检测是保证航天器稳定性的关键。在航天器运行过程中&#xff0c;传感器和控制器产生大量周…...

    2024/5/4 13:16:06
  19. --max-old-space-size=8192报错

    vue项目运行时&#xff0c;如果经常运行慢&#xff0c;崩溃停止服务&#xff0c;报如下错误 FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory 因为在 Node 中&#xff0c;通过JavaScript使用内存时只能使用部分内存&#xff08;64位系统&…...

    2024/5/5 17:03:52
  20. 基于深度学习的恶意软件检测

    恶意软件是指恶意软件犯罪者用来感染个人计算机或整个组织的网络的软件。 它利用目标系统漏洞&#xff0c;例如可以被劫持的合法软件&#xff08;例如浏览器或 Web 应用程序插件&#xff09;中的错误。 恶意软件渗透可能会造成灾难性的后果&#xff0c;包括数据被盗、勒索或网…...

    2024/5/4 14:46:05
  21. JS原型对象prototype

    让我简单的为大家介绍一下原型对象prototype吧&#xff01; 使用原型实现方法共享 1.构造函数通过原型分配的函数是所有对象所 共享的。 2.JavaScript 规定&#xff0c;每一个构造函数都有一个 prototype 属性&#xff0c;指向另一个对象&#xff0c;所以我们也称为原型对象…...

    2024/5/5 3:37:58
  22. C++中只能有一个实例的单例类

    C中只能有一个实例的单例类 前面讨论的 President 类很不错&#xff0c;但存在一个缺陷&#xff1a;无法禁止通过实例化多个对象来创建多名总统&#xff1a; President One, Two, Three; 由于复制构造函数是私有的&#xff0c;其中每个对象都是不可复制的&#xff0c;但您的目…...

    2024/5/4 23:54:30
  23. python django 小程序图书借阅源码

    开发工具&#xff1a; PyCharm&#xff0c;mysql5.7&#xff0c;微信开发者工具 技术说明&#xff1a; python django html 小程序 功能介绍&#xff1a; 用户端&#xff1a; 登录注册&#xff08;含授权登录&#xff09; 首页显示搜索图书&#xff0c;轮播图&#xff0…...

    2024/5/5 17:03:21
  24. 电子学会C/C++编程等级考试2022年03月(一级)真题解析

    C/C++等级考试(1~8级)全部真题・点这里 第1题:双精度浮点数的输入输出 输入一个双精度浮点数,保留8位小数,输出这个浮点数。 时间限制:1000 内存限制:65536输入 只有一行,一个双精度浮点数。输出 一行,保留8位小数的浮点数。样例输入 3.1415926535798932样例输出 3.1…...

    2024/5/5 15:25:31
  25. 配置失败还原请勿关闭计算机,电脑开机屏幕上面显示,配置失败还原更改 请勿关闭计算机 开不了机 这个问题怎么办...

    解析如下&#xff1a;1、长按电脑电源键直至关机&#xff0c;然后再按一次电源健重启电脑&#xff0c;按F8健进入安全模式2、安全模式下进入Windows系统桌面后&#xff0c;按住“winR”打开运行窗口&#xff0c;输入“services.msc”打开服务设置3、在服务界面&#xff0c;选中…...

    2022/11/19 21:17:18
  26. 错误使用 reshape要执行 RESHAPE,请勿更改元素数目。

    %读入6幅图像&#xff08;每一幅图像的大小是564*564&#xff09; f1 imread(WashingtonDC_Band1_564.tif); subplot(3,2,1),imshow(f1); f2 imread(WashingtonDC_Band2_564.tif); subplot(3,2,2),imshow(f2); f3 imread(WashingtonDC_Band3_564.tif); subplot(3,2,3),imsho…...

    2022/11/19 21:17:16
  27. 配置 已完成 请勿关闭计算机,win7系统关机提示“配置Windows Update已完成30%请勿关闭计算机...

    win7系统关机提示“配置Windows Update已完成30%请勿关闭计算机”问题的解决方法在win7系统关机时如果有升级系统的或者其他需要会直接进入一个 等待界面&#xff0c;在等待界面中我们需要等待操作结束才能关机&#xff0c;虽然这比较麻烦&#xff0c;但是对系统进行配置和升级…...

    2022/11/19 21:17:15
  28. 台式电脑显示配置100%请勿关闭计算机,“准备配置windows 请勿关闭计算机”的解决方法...

    有不少用户在重装Win7系统或更新系统后会遇到“准备配置windows&#xff0c;请勿关闭计算机”的提示&#xff0c;要过很久才能进入系统&#xff0c;有的用户甚至几个小时也无法进入&#xff0c;下面就教大家这个问题的解决方法。第一种方法&#xff1a;我们首先在左下角的“开始…...

    2022/11/19 21:17:14
  29. win7 正在配置 请勿关闭计算机,怎么办Win7开机显示正在配置Windows Update请勿关机...

    置信有很多用户都跟小编一样遇到过这样的问题&#xff0c;电脑时发现开机屏幕显现“正在配置Windows Update&#xff0c;请勿关机”(如下图所示)&#xff0c;而且还需求等大约5分钟才干进入系统。这是怎样回事呢&#xff1f;一切都是正常操作的&#xff0c;为什么开时机呈现“正…...

    2022/11/19 21:17:13
  30. 准备配置windows 请勿关闭计算机 蓝屏,Win7开机总是出现提示“配置Windows请勿关机”...

    Win7系统开机启动时总是出现“配置Windows请勿关机”的提示&#xff0c;没过几秒后电脑自动重启&#xff0c;每次开机都这样无法进入系统&#xff0c;此时碰到这种现象的用户就可以使用以下5种方法解决问题。方法一&#xff1a;开机按下F8&#xff0c;在出现的Windows高级启动选…...

    2022/11/19 21:17:12
  31. 准备windows请勿关闭计算机要多久,windows10系统提示正在准备windows请勿关闭计算机怎么办...

    有不少windows10系统用户反映说碰到这样一个情况&#xff0c;就是电脑提示正在准备windows请勿关闭计算机&#xff0c;碰到这样的问题该怎么解决呢&#xff0c;现在小编就给大家分享一下windows10系统提示正在准备windows请勿关闭计算机的具体第一种方法&#xff1a;1、2、依次…...

    2022/11/19 21:17:11
  32. 配置 已完成 请勿关闭计算机,win7系统关机提示“配置Windows Update已完成30%请勿关闭计算机”的解决方法...

    今天和大家分享一下win7系统重装了Win7旗舰版系统后&#xff0c;每次关机的时候桌面上都会显示一个“配置Windows Update的界面&#xff0c;提示请勿关闭计算机”&#xff0c;每次停留好几分钟才能正常关机&#xff0c;导致什么情况引起的呢&#xff1f;出现配置Windows Update…...

    2022/11/19 21:17:10
  33. 电脑桌面一直是清理请关闭计算机,windows7一直卡在清理 请勿关闭计算机-win7清理请勿关机,win7配置更新35%不动...

    只能是等着&#xff0c;别无他法。说是卡着如果你看硬盘灯应该在读写。如果从 Win 10 无法正常回滚&#xff0c;只能是考虑备份数据后重装系统了。解决来方案一&#xff1a;管理员运行cmd&#xff1a;net stop WuAuServcd %windir%ren SoftwareDistribution SDoldnet start WuA…...

    2022/11/19 21:17:09
  34. 计算机配置更新不起,电脑提示“配置Windows Update请勿关闭计算机”怎么办?

    原标题&#xff1a;电脑提示“配置Windows Update请勿关闭计算机”怎么办&#xff1f;win7系统中在开机与关闭的时候总是显示“配置windows update请勿关闭计算机”相信有不少朋友都曾遇到过一次两次还能忍但经常遇到就叫人感到心烦了遇到这种问题怎么办呢&#xff1f;一般的方…...

    2022/11/19 21:17:08
  35. 计算机正在配置无法关机,关机提示 windows7 正在配置windows 请勿关闭计算机 ,然后等了一晚上也没有关掉。现在电脑无法正常关机...

    关机提示 windows7 正在配置windows 请勿关闭计算机 &#xff0c;然后等了一晚上也没有关掉。现在电脑无法正常关机以下文字资料是由(历史新知网www.lishixinzhi.com)小编为大家搜集整理后发布的内容&#xff0c;让我们赶快一起来看一下吧&#xff01;关机提示 windows7 正在配…...

    2022/11/19 21:17:05
  36. 钉钉提示请勿通过开发者调试模式_钉钉请勿通过开发者调试模式是真的吗好不好用...

    钉钉请勿通过开发者调试模式是真的吗好不好用 更新时间:2020-04-20 22:24:19 浏览次数:729次 区域: 南阳 > 卧龙 列举网提醒您:为保障您的权益,请不要提前支付任何费用! 虚拟位置外设器!!轨迹模拟&虚拟位置外设神器 专业用于:钉钉,外勤365,红圈通,企业微信和…...

    2022/11/19 21:17:05
  37. 配置失败还原请勿关闭计算机怎么办,win7系统出现“配置windows update失败 还原更改 请勿关闭计算机”,长时间没反应,无法进入系统的解决方案...

    前几天班里有位学生电脑(windows 7系统)出问题了&#xff0c;具体表现是开机时一直停留在“配置windows update失败 还原更改 请勿关闭计算机”这个界面&#xff0c;长时间没反应&#xff0c;无法进入系统。这个问题原来帮其他同学也解决过&#xff0c;网上搜了不少资料&#x…...

    2022/11/19 21:17:04
  38. 一个电脑无法关闭计算机你应该怎么办,电脑显示“清理请勿关闭计算机”怎么办?...

    本文为你提供了3个有效解决电脑显示“清理请勿关闭计算机”问题的方法&#xff0c;并在最后教给你1种保护系统安全的好方法&#xff0c;一起来看看&#xff01;电脑出现“清理请勿关闭计算机”在Windows 7(SP1)和Windows Server 2008 R2 SP1中&#xff0c;添加了1个新功能在“磁…...

    2022/11/19 21:17:03
  39. 请勿关闭计算机还原更改要多久,电脑显示:配置windows更新失败,正在还原更改,请勿关闭计算机怎么办...

    许多用户在长期不使用电脑的时候&#xff0c;开启电脑发现电脑显示&#xff1a;配置windows更新失败&#xff0c;正在还原更改&#xff0c;请勿关闭计算机。。.这要怎么办呢&#xff1f;下面小编就带着大家一起看看吧&#xff01;如果能够正常进入系统&#xff0c;建议您暂时移…...

    2022/11/19 21:17:02
  40. 还原更改请勿关闭计算机 要多久,配置windows update失败 还原更改 请勿关闭计算机,电脑开机后一直显示以...

    配置windows update失败 还原更改 请勿关闭计算机&#xff0c;电脑开机后一直显示以以下文字资料是由(历史新知网www.lishixinzhi.com)小编为大家搜集整理后发布的内容&#xff0c;让我们赶快一起来看一下吧&#xff01;配置windows update失败 还原更改 请勿关闭计算机&#x…...

    2022/11/19 21:17:01
  41. 电脑配置中请勿关闭计算机怎么办,准备配置windows请勿关闭计算机一直显示怎么办【图解】...

    不知道大家有没有遇到过这样的一个问题&#xff0c;就是我们的win7系统在关机的时候&#xff0c;总是喜欢显示“准备配置windows&#xff0c;请勿关机”这样的一个页面&#xff0c;没有什么大碍&#xff0c;但是如果一直等着的话就要两个小时甚至更久都关不了机&#xff0c;非常…...

    2022/11/19 21:17:00
  42. 正在准备配置请勿关闭计算机,正在准备配置windows请勿关闭计算机时间长了解决教程...

    当电脑出现正在准备配置windows请勿关闭计算机时&#xff0c;一般是您正对windows进行升级&#xff0c;但是这个要是长时间没有反应&#xff0c;我们不能再傻等下去了。可能是电脑出了别的问题了&#xff0c;来看看教程的说法。正在准备配置windows请勿关闭计算机时间长了方法一…...

    2022/11/19 21:16:59
  43. 配置失败还原请勿关闭计算机,配置Windows Update失败,还原更改请勿关闭计算机...

    我们使用电脑的过程中有时会遇到这种情况&#xff0c;当我们打开电脑之后&#xff0c;发现一直停留在一个界面&#xff1a;“配置Windows Update失败&#xff0c;还原更改请勿关闭计算机”&#xff0c;等了许久还是无法进入系统。如果我们遇到此类问题应该如何解决呢&#xff0…...

    2022/11/19 21:16:58
  44. 如何在iPhone上关闭“请勿打扰”

    Apple’s “Do Not Disturb While Driving” is a potentially lifesaving iPhone feature, but it doesn’t always turn on automatically at the appropriate time. For example, you might be a passenger in a moving car, but your iPhone may think you’re the one dri…...

    2022/11/19 21:16:57