centos7.5安装公版mysql5.7.25
#########
卸载原来系统安装的包
# yum remove -y java cvs libselinux-devel postgresql mysql ecj jna sinjdoc
依赖包安装
# yum install -y numactl git lrzsz screen make cmake gcc gcc-c++ libaio libaio-devel automake autoconf bzr bison libtool ncurses-devel ncurses vim numactl-devel sendmail perl-CPAN perl-Time-HiRes perl-LWP-Authen-Negotiate patch cpan perl-DBD-MySQL perl-YAML perl-File-Which perl-DBI perl-Digest-SHA1 perl-Time-HiRes perl-LWP-Authen-Negotiate bind-utils zlib-devel perl-Config-Tiny perl-Log-Dispatch perl-Parallel-ForkManager perl-JSON.noarch openssh-server openssh rsyslog perl openssl openssl-devel libgcrypt-devel
# make cmake automake autoconf gcc gcc-c++ vim git lrzsz sendmail ntp bzr bzip flex bison patch cpan rsyslog numactl screen bind-utils coreutils glib2 mpstat dstat sysstat e4fsprogs xfsprogs
# libaio libaio-devel
# libgcrypt-devel
# libxml2-devel
# libxslt-devel
# ncurses ncurses-devel
# openssh openssh-server openssl openssl-devel
# zlib-devel
# numactl-devel
# perl perl-devel perl* perl-ExtUtils*
# openldap-devel
# python-devel
# tcl-devel
# curl-devel
# expat-devel
# gettext-devel
############初始化
./bin/mysqld --defaults-file=/home/cdrom/work/mysql_3307/etc/my.cnf --initialize-insecure --user=work --basedir=/home/cdrom/work/mysql_3307
# 执行过程详细情况如下:
[work@a8-dba-cloud-db00.wh log]$ tail -f mysql.err 2019-11-22T22:50:35.617244+08:00 0 [Note] InnoDB: Setting file './ibdata1' size to 100 MB. Physically writing the file full; Please wait ... 2019-11-22T22:50:35.617619+08:00 0 [Note] InnoDB: Progress in MB: 100 2019-11-22T22:50:36.505698+08:00 0 [Note] InnoDB: File './ibdata1' size is now 100 MB. 2019-11-22T22:50:36.506527+08:00 0 [Note] InnoDB: Setting log file ./ib_logfile101 size to 4096 MB 2019-11-22T22:50:36.506768+08:00 0 [Note] InnoDB: Progress in MB: 100 200 300 400 500 600 700 800 900 1000 1100 1200 1300 1400 1500 1600 1700 1800 1900 2000 2100 2200 2300 2400 2500 2600 2700 2800 2900 3000 3100 3200 3300 3400 3500 3600 3700 3800 3900 4000 2019-11-22T22:51:20.789304+08:00 0 [Note] InnoDB: Setting log file ./ib_logfile1 size to 4096 MB 2019-11-22T22:51:20.789537+08:00 0 [Note] InnoDB: Progress in MB: 100 200 300 400 500 600 700 800 900 1000 1100 1200 1300 1400 1500 1600 1700 1800 1900 2000 2100 2200 2300 2400 2500 2600 2700 2800 2900 3000 3100 3200 3300 3400 3500 3600 3700 3800 3900 4000 2019-11-22T22:52:08.483251+08:00 0 [Note] InnoDB: Setting log file ./ib_logfile2 size to 4096 MB 2019-11-22T22:52:08.483529+08:00 0 [Note] InnoDB: Progress in MB: 100 200 300 400 500 600 700 800 900 1000 1100 1200 1300 1400 1500 1600 1700 1800 1900 2000 2100 2200 2300 2400 2500 2600 2700 2800 2900 3000 3100 3200 3300 3400 3500 3600 3700 3800 3900 4000 2019-11-22T22:52:55.159211+08:00 0 [Note] InnoDB: Renaming log file ./ib_logfile101 to ./ib_logfile0 2019-11-22T22:52:55.160086+08:00 0 [Warning] InnoDB: New log files created, LSN=45790 2019-11-22T22:52:55.160129+08:00 0 [Note] InnoDB: Creating shared tablespace for temporary tables 2019-11-22T22:52:55.160256+08:00 0 [Note] InnoDB: Setting file './ibtmp1' size to 12 MB. Physically writing the file full; Please wait ... 2019-11-22T22:52:55.196141+08:00 0 [Note] InnoDB: File './ibtmp1' size is now 12 MB. 2019-11-22T22:52:55.196576+08:00 0 [Note] InnoDB: Doublewrite buffer not found: creating new 2019-11-22T22:52:55.213558+08:00 0 [Note] InnoDB: Doublewrite buffer created 2019-11-22T22:52:55.226037+08:00 0 [Note] InnoDB: 96 redo rollback segment(s) found. 96 redo rollback segment(s) are active. 2019-11-22T22:52:55.226103+08:00 0 [Note] InnoDB: 32 non-redo rollback segment(s) are active. 2019-11-22T22:52:55.227122+08:00 0 [Warning] InnoDB: Creating foreign key constraint system tables. 2019-11-22T22:52:55.236668+08:00 0 [Note] InnoDB: Foreign key constraint system tables created 2019-11-22T22:52:55.236822+08:00 0 [Note] InnoDB: Creating tablespace and datafile system tables. 2019-11-22T22:52:55.238879+08:00 0 [Note] InnoDB: Tablespace and datafile system tables created. 2019-11-22T22:52:55.238968+08:00 0 [Note] InnoDB: Creating sys_virtual system tables. 2019-11-22T22:52:55.240446+08:00 0 [Note] InnoDB: sys_virtual table created 2019-11-22T22:52:55.240917+08:00 0 [Note] InnoDB: Waiting for purge to start 2019-11-22T22:52:55.291193+08:00 0 [Note] InnoDB: 5.7.27 started; log sequence number 0 2019-11-22T22:52:55.291233+08:00 0 [Note] InnoDB: page_cleaner: 1000ms intended loop took 139687ms. The settings might not be optimal. (flushed=0 and evicted=0, during the time.) 2019-11-22T22:52:55.295328+08:00 0 [Note] Plugin 'FEDERATED' is disabled. 2019-11-22T22:52:55.313526+08:00 0 [Note] Salting uuid generator variables, current_pid: 16334, server_start_time: 1574434235, bytes_sent: 0, 2019-11-22T22:52:55.315222+08:00 0 [Note] Generated uuid: 'c42216ad-0d37-11ea-b163-2016d8c96b46', server_start_time: 4597612271166305673, bytes_sent: 118605712 2019-11-22T22:52:55.315283+08:00 0 [Warning] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: c42216ad-0d37-11ea-b163-2016d8c96b46. 2019-11-22T22:52:55.318419+08:00 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened. 2019-11-22T22:52:55.323174+08:00 1 [Note] Creating the system database 2019-11-22T22:52:55.323226+08:00 1 [Warning] root@localhost is created with an empty password ! Please consider switching off the --initialize-insecure option. 2019-11-22T22:52:55.327464+08:00 1 [Note] Creating the system tables 2019-11-22T22:52:55.730845+08:00 1 [Note] Filling in the system tables, part 1 2019-11-22T22:52:55.732873+08:00 1 [Note] Filling in the system tables, part 2 2019-11-22T22:52:55.732901+08:00 1 [Note] Filling in the mysql.help table 2019-11-22T22:52:56.027656+08:00 1 [Note] Creating user for internal session service 2019-11-22T22:52:56.028500+08:00 1 [Note] Creating the sys schema 2019-11-22T22:52:56.292510+08:00 1 [Note] Bootstrapping complete 2019-11-22T22:52:56.293035+08:00 0 [Note] Giving 0 client threads a chance to die gracefully 2019-11-22T22:52:56.293068+08:00 0 [Note] Shutting down slave threads 2019-11-22T22:52:56.293081+08:00 0 [Note] Forcefully disconnecting 0 remaining clients 2019-11-22T22:52:56.296720+08:00 0 [Note] Binlog end 2019-11-22T22:52:56.298692+08:00 0 [Note] InnoDB: FTS optimize thread exiting. 2019-11-22T22:52:56.298906+08:00 0 [Note] InnoDB: Starting shutdown... 2019-11-22T22:52:56.399347+08:00 0 [Note] InnoDB: Dumping buffer pool(s) to /home/cdrom/work/mysql_3307/data/ib_buffer_pool 2019-11-22T22:52:56.400218+08:00 0 [Note] InnoDB: Buffer pool(s) dump completed at 191122 22:52:56 2019-11-22T22:52:58.298176+08:00 0 [Note] InnoDB: Shutdown completed; log sequence number 2625438 2019-11-22T22:52:58.298282+08:00 0 [Note] InnoDB: Removed temporary tablespace data file: "ibtmp1"
修改配置文件并启动,使其免密码登陆
#################启动并登陆修改密码
/home/cdrom/work/mysql_3307/bin/mysqld_safe --defaults-file=/home/cdrom/work/mysql_3307/etc/my.cnf --datadir=/home/cdrom/work/mysql_3307/data --pid-file=/home/cdrom/work/mysql_3307/tmp/mysql.pid
第一次启动详细过程如下:
2019-11-22T15:53:29.822348Z mysqld_safe Logging to '/home/cdrom/work/mysql_3307/log/mysql.err'. 2019-11-22T15:53:29.852036Z mysqld_safe Starting mysqld daemon with databases from /home/cdrom/work/mysql_3308/data 2019-11-22T15:53:29.867928Z 0 [Warning] Could not increase number of max_open_files to more than 1024 (request: 20394) 2019-11-22T15:53:29.868027Z 0 [Warning] Changed limits: max_connections: 214 (requested 4000) 2019-11-22T15:53:29.868031Z 0 [Warning] Changed limits: table_open_cache: 400 (requested 8192) 2019-11-22T23:53:30.037210+08:00 0 [Warning] option 'general_log': boolean value '/home/cdrom/work/mysql_3307/log/mysql.log' wasn't recognized. Set to OFF. 2019-11-22T23:53:30.037231+08:00 0 [Warning] option 'general_log': boolean value '/home/cdrom/work/mysql_3307/log/mysql.log' wasn't recognized. Set to OFF. 2019-11-22T23:53:30.037238+08:00 0 [Warning] The syntax '--log_warnings/-W' is deprecated and will be removed in a future release. Please use '--log_error_verbosity' instead. 2019-11-22T23:53:30.037391+08:00 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details). 2019-11-22T23:53:30.037428+08:00 0 [Note] --secure-file-priv is set to NULL. Operations related to importing and exporting data are disabled 2019-11-22T23:53:30.037463+08:00 0 [Note] /home/cdrom/work/mysql_3307/bin/mysqld (mysqld 5.7.27-log) starting as process 6467 ... 2019-11-22T23:53:30.047711+08:00 0 [Warning] option 'innodb-buffer-pool-chunk-size': unsigned value 128 adjusted to 1048576 2019-11-22T23:53:30.048165+08:00 0 [Warning] InnoDB: innodb_open_files should not be greater than the open_files_limit. 2019-11-22T23:53:30.048250+08:00 0 [Note] InnoDB: PUNCH HOLE support available 2019-11-22T23:53:30.048270+08:00 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins 2019-11-22T23:53:30.048286+08:00 0 [Note] InnoDB: Uses event mutexes 2019-11-22T23:53:30.048302+08:00 0 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier 2019-11-22T23:53:30.048313+08:00 0 [Note] InnoDB: Compressed tables use zlib 1.2.11 2019-11-22T23:53:30.048325+08:00 0 [Note] InnoDB: Using Linux native AIO 2019-11-22T23:53:30.048621+08:00 0 [Note] InnoDB: Number of pools: 1 2019-11-22T23:53:30.048770+08:00 0 [Note] InnoDB: Using CPU crc32 instructions 2019-11-22T23:53:30.050544+08:00 0 [Note] InnoDB: Initializing buffer pool, total size = 2G, instances = 8, chunk size = 1M 2019-11-22T23:53:30.188178+08:00 0 [Note] InnoDB: Completed initialization of buffer pool 2019-11-22T23:53:30.209757+08:00 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority(). 2019-11-22T23:53:30.227598+08:00 0 [Note] InnoDB: Highest supported file format is Barracuda. 2019-11-22T23:53:30.327026+08:00 0 [Note] InnoDB: Creating shared tablespace for temporary tables 2019-11-22T23:53:30.327140+08:00 0 [Note] InnoDB: Setting file './ibtmp1' size to 12 MB. Physically writing the file full; Please wait ... 2019-11-22T23:53:30.356049+08:00 0 [Note] InnoDB: File './ibtmp1' size is now 12 MB. 2019-11-22T23:53:30.357702+08:00 0 [Note] InnoDB: 96 redo rollback segment(s) found. 96 redo rollback segment(s) are active. 2019-11-22T23:53:30.357759+08:00 0 [Note] InnoDB: 32 non-redo rollback segment(s) are active. 2019-11-22T23:53:30.358223+08:00 0 [Note] InnoDB: Waiting for purge to start 2019-11-22T23:53:30.408862+08:00 0 [Note] InnoDB: 5.7.27 started; log sequence number 2625438 2019-11-22T23:53:30.415111+08:00 0 [Note] InnoDB: Loading buffer pool(s) from /home/cdrom/work/mysql_3307/data/ib_buffer_pool 2019-11-22T23:53:30.415595+08:00 0 [Note] Plugin 'FEDERATED' is disabled. 2019-11-22T23:53:30.448392+08:00 0 [Warning] Failed to set up SSL because of the following SSL library error: SSL context is not usable without certificate and private key 2019-11-22T23:53:30.448460+08:00 0 [Note] Server hostname (bind-address): '*'; port: 3308 2019-11-22T23:53:30.448566+08:00 0 [Note] IPv6 is available. 2019-11-22T23:53:30.448620+08:00 0 [Note] - '::' resolves to '::'; 2019-11-22T23:53:30.448730+08:00 0 [Note] Server socket created on IP: '::'. 2019-11-22T23:53:30.450563+08:00 0 [Warning] Insecure configuration for --pid-file: Location '/home/cdrom/work' in the path is accessible to all OS users. Consider choosing a different directory. 2019-11-22T23:53:30.458231+08:00 0 [Note] InnoDB: Buffer pool(s) load completed at 191122 23:53:30 2019-11-22T23:53:30.459298+08:00 0 [Note] Failed to start slave threads for channel '' 2019-11-22T23:53:30.470390+08:00 0 [Note] /home/cdrom/work/mysql_3306/bin/mysqld: ready for connections. Version: '5.7.27-log' socket: '/home/cdrom/work/mysql_3307/tmp/mysql.sock' port: 3307 MySQL Community Server (GPL)
#########
# mysql -uroot
> use mysql;
> update user set authentication_string=password('root') where user='root';
#####################再次将配置文件中的免密码登陆去掉,重启服务即可