#使用mysql就可以愉快连接数据库了 [root@db01 ~]# mysql Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 3 Server version: 5.6.50 Source distribution Copyright (c) 2000, 2020, 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'forhelp. Type '\c' to clear the current input statement. mysql>
启动数据库报错解决
1 2 3 4 5 6 7 8 9 10 11 12 13
[root@db01 ~]# /etc/init.d/mysqld start Starting MySQL.Logging to '/app/mysql-5.6.50/data/db01.err'. 240807 14:03:01 mysqld_safe Directory '/app/mysql-5.6.50/tmp'for UNIX socket file don't exists. ERROR! The server quit without updating PID file (/app/mysql-5.6.50/data/db01.pid). #报错分析: ERROR! The server quit without updating PID file (/app/mysql-5.6.50/data/db01.pid). #没有pid文件,为啥没有? 只有程序启动才会有pid文件,说明mysql根本就没有正常启动 #往上分析 240807 14:03:01 mysqld_safe Directory '/app/mysql-5.6.50/tmp' for UNIX socket file don't exists. #socket 文件不存在?
#再次执行启动命令 [root@db01 ~]# /etc/init.d/mysqld start Starting MySQL.Logging to '/app/mysql-5.6.50/data/db01.err'. ... ERROR! The server quit without updating PID file (/app/mysql-5.6.50/data/db01.pid).
#分析:看日志 [root@db01 ~]# cat /app/mysql-5.6.50/data/db01.err 2024-08-07 15:04:15 24317 [Note] Plugin 'FEDERATED' is disabled. 2024-08-07 15:04:15 24317 [Note] InnoDB: Using atomics to ref count buffer pool pages 2024-08-07 15:04:15 24317 [Note] InnoDB: The InnoDB memory heap is disabled 2024-08-07 15:04:15 24317 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins 2024-08-07 15:04:15 24317 [Note] InnoDB: Memory barrier is not used 2024-08-07 15:04:15 24317 [Note] InnoDB: Compressed tables use zlib 1.2.11 2024-08-07 15:04:15 24317 [Note] InnoDB: Using Linux native AIO 2024-08-07 15:04:15 24317 [Note] InnoDB: Using CPU crc32 instructions 2024-08-07 15:04:15 24317 [Note] InnoDB: Initializing buffer pool, size = 128.0M 2024-08-07 15:04:15 24317 [Note] InnoDB: Completed initialization of buffer pool 2024-08-07 15:04:15 24317 [Note] InnoDB: Highest supported file format is Barracuda. 2024-08-07 15:04:15 24317 [Note] InnoDB: 128 rollback segment(s) are active. 2024-08-07 15:04:15 24317 [Note] InnoDB: Waiting for purge to start 2024-08-07 15:04:15 24317 [Note] InnoDB: 5.6.50 started; log sequence number 1625987 2024-08-07 15:04:15 24317 [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: 421a7ae9-548b-11ef-aa26-000c292b15c7. 2024-08-07 15:04:15 24317 [Note] RSA private key file not found: /app/mysql-5.6.50/data//private_key.pem. Some authentication plugins will not work. 2024-08-07 15:04:15 24317 [Note] RSA public key file not found: /app/mysql-5.6.50/data//public_key.pem. Some authentication plugins will not work. 2024-08-07 15:04:15 24317 [Note] Server hostname (bind-address): '*'; port: 3306 2024-08-07 15:04:15 24317 [Note] IPv6 is available. 2024-08-07 15:04:15 24317 [Note] - '::' resolves to '::'; 2024-08-07 15:04:15 24317 [Note] Server socket created on IP: '::'. 2024-08-07 15:04:15 24317 [ERROR] Can't start server : Bind on unix socket: Permission denied 2024-08-07 15:04:15 24317 [ERROR] Do you already have another mysqld server running on socket: /app/mysql-5.6.50/tmp/mysql.sock ? 2024-08-07 15:04:15 24317 [ERROR] Aborting 2024-08-07 15:04:15 24317 [Note] Binlog end 2024-08-07 15:04:15 24317 [Note] Shutting down plugin 'partition' 2024-08-07 15:04:15 24317 [Note] Shutting down plugin 'PERFORMANCE_SCHEMA' 2024-08-07 15:04:15 24317 [Note] Shutting down plugin 'INNODB_SYS_DATAFILES' 2024-08-07 15:04:15 24317 [Note] Shutting down plugin 'INNODB_SYS_TABLESPACES' 2024-08-07 15:04:15 24317 [Note] Shutting down plugin 'INNODB_SYS_FOREIGN_COLS' 2024-08-07 15:04:15 24317 [Note] Shutting down plugin 'INNODB_SYS_FOREIGN' 2024-08-07 15:04:15 24317 [Note] Shutting down plugin 'INNODB_SYS_FIELDS' 2024-08-07 15:04:15 24317 [Note] Shutting down plugin 'INNODB_SYS_COLUMNS' 2024-08-07 15:04:15 24317 [Note] Shutting down plugin 'INNODB_SYS_INDEXES' 2024-08-07 15:04:15 24317 [Note] Shutting down plugin 'INNODB_SYS_TABLESTATS' 2024-08-07 15:04:15 24317 [Note] Shutting down plugin 'INNODB_SYS_TABLES' 2024-08-07 15:04:15 24317 [Note] Shutting down plugin 'INNODB_FT_INDEX_TABLE' 2024-08-07 15:04:15 24317 [Note] Shutting down plugin 'INNODB_FT_INDEX_CACHE' 2024-08-07 15:04:15 24317 [Note] Shutting down plugin 'INNODB_FT_CONFIG' 2024-08-07 15:04:15 24317 [Note] Shutting down plugin 'INNODB_FT_BEING_DELETED' 2024-08-07 15:04:15 24317 [Note] Shutting down plugin 'INNODB_FT_DELETED' 2024-08-07 15:04:15 24317 [Note] Shutting down plugin 'INNODB_FT_DEFAULT_STOPWORD' 2024-08-07 15:04:15 24317 [Note] Shutting down plugin 'INNODB_METRICS' 2024-08-07 15:04:15 24317 [Note] Shutting down plugin 'INNODB_BUFFER_POOL_STATS' 2024-08-07 15:04:15 24317 [Note] Shutting down plugin 'INNODB_BUFFER_PAGE_LRU' 2024-08-07 15:04:15 24317 [Note] Shutting down plugin 'INNODB_BUFFER_PAGE' 2024-08-07 15:04:15 24317 [Note] Shutting down plugin 'INNODB_CMP_PER_INDEX_RESET' 2024-08-07 15:04:15 24317 [Note] Shutting down plugin 'INNODB_CMP_PER_INDEX' 2024-08-07 15:04:15 24317 [Note] Shutting down plugin 'INNODB_CMPMEM_RESET' 2024-08-07 15:04:15 24317 [Note] Shutting down plugin 'INNODB_CMPMEM' 2024-08-07 15:04:15 24317 [Note] Shutting down plugin 'INNODB_CMP_RESET' 2024-08-07 15:04:15 24317 [Note] Shutting down plugin 'INNODB_CMP' 2024-08-07 15:04:15 24317 [Note] Shutting down plugin 'INNODB_LOCK_WAITS' 2024-08-07 15:04:15 24317 [Note] Shutting down plugin 'INNODB_LOCKS' 2024-08-07 15:04:15 24317 [Note] Shutting down plugin 'INNODB_TRX' 2024-08-07 15:04:15 24317 [Note] Shutting down plugin 'InnoDB' 2024-08-07 15:04:15 24317 [Note] InnoDB: FTS optimize thread exiting. 2024-08-07 15:04:15 24317 [Note] InnoDB: Starting shutdown... 2024-08-07 15:04:17 24317 [Note] InnoDB: Shutdown completed; log sequence number 1625997 2024-08-07 15:04:17 24317 [Note] Shutting down plugin 'BLACKHOLE' 2024-08-07 15:04:17 24317 [Note] Shutting down plugin 'ARCHIVE' 2024-08-07 15:04:17 24317 [Note] Shutting down plugin 'MRG_MYISAM' 2024-08-07 15:04:17 24317 [Note] Shutting down plugin 'MyISAM' 2024-08-07 15:04:17 24317 [Note] Shutting down plugin 'MEMORY' 2024-08-07 15:04:17 24317 [Note] Shutting down plugin 'CSV' 2024-08-07 15:04:17 24317 [Note] Shutting down plugin 'sha256_password' 2024-08-07 15:04:17 24317 [Note] Shutting down plugin 'mysql_old_password' 2024-08-07 15:04:17 24317 [Note] Shutting down plugin 'mysql_native_password' 2024-08-07 15:04:17 24317 [Note] Shutting down plugin 'binlog' 2024-08-07 15:04:17 24317 [Note] /app/mysql-5.6.50/bin/mysqld: Shutdown complete
[root@db01 mysql-5.6.50]# mysql -bash: mysql: command not found #为啥没有mysql命令? 没有添加环境变量,mysql命令在/app/mysql-5.6.50/bin下
#使用绝对路径也可以启动 [root@db01 mysql-5.6.50]# /app/mysql-5.6.50/bin/mysql Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 1 Server version: 5.6.50 Source distribution
Copyright (c) 2000, 2020, 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'forhelp. Type '\c' to clear the current input statement.
#报错 FATAL ERROR: please install the following Perl modules before executing /app/mysql-5.6.50/scripts/mysql_install_db: Data::Dumper #解决方法是安装autoconf库和libaio库文件 yum -y install autoconf libaio-devel
#再次执行初始化数据库操作 [root@db01 ~]# /app/mysql-5.6.50/scripts/mysql_install_db --user=mysql --basedir=/app/mysql-5.6.50 --datadir=/app/mysql-5.6.50/data Installing MySQL system tables...2024-08-07 14:00:39 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details). 2024-08-07 14:00:39 0 [Note] Ignoring --secure-file-priv value as server is running with --bootstrap. 2024-08-07 14:00:39 0 [Note] /app/mysql-5.6.50/bin/mysqld (mysqld 5.6.50) starting as process 23552 ... 2024-08-07 14:00:39 23552 [Note] InnoDB: Using atomics to ref count buffer pool pages 2024-08-07 14:00:39 23552 [Note] InnoDB: The InnoDB memory heap is disabled 2024-08-07 14:00:39 23552 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins 2024-08-07 14:00:39 23552 [Note] InnoDB: Memory barrier is not used 2024-08-07 14:00:39 23552 [Note] InnoDB: Compressed tables use zlib 1.2.11 2024-08-07 14:00:39 23552 [Note] InnoDB: Using Linux native AIO 2024-08-07 14:00:39 23552 [Note] InnoDB: Using CPU crc32 instructions 2024-08-07 14:00:39 23552 [Note] InnoDB: Initializing buffer pool, size = 128.0M 2024-08-07 14:00:39 23552 [Note] InnoDB: Completed initialization of buffer pool 2024-08-07 14:00:39 23552 [Note] InnoDB: The first specified data file ./ibdata1 did not exist: a new database to be created! 2024-08-07 14:00:39 23552 [Note] InnoDB: Setting file ./ibdata1 size to 12 MB 2024-08-07 14:00:39 23552 [Note] InnoDB: Database physically writes the file full: wait... 2024-08-07 14:00:39 23552 [Note] InnoDB: Setting log file ./ib_logfile101 size to 48 MB 2024-08-07 14:00:39 23552 [Note] InnoDB: Setting log file ./ib_logfile1 size to 48 MB 2024-08-07 14:00:39 23552 [Note] InnoDB: Renaming log file ./ib_logfile101 to ./ib_logfile0 2024-08-07 14:00:39 23552 [Warning] InnoDB: New log files created, LSN=45781 2024-08-07 14:00:39 23552 [Note] InnoDB: Doublewrite buffer not found: creating new 2024-08-07 14:00:39 23552 [Note] InnoDB: Doublewrite buffer created 2024-08-07 14:00:39 23552 [Note] InnoDB: 128 rollback segment(s) are active. 2024-08-07 14:00:39 23552 [Warning] InnoDB: Creating foreign key constraint system tables. 2024-08-07 14:00:39 23552 [Note] InnoDB: Foreign key constraint system tables created 2024-08-07 14:00:39 23552 [Note] InnoDB: Creating tablespace and datafile system tables. 2024-08-07 14:00:39 23552 [Note] InnoDB: Tablespace and datafile system tables created. 2024-08-07 14:00:39 23552 [Note] InnoDB: Waiting for purge to start 2024-08-07 14:00:39 23552 [Note] InnoDB: 5.6.50 started; log sequence number 0 2024-08-07 14:00:39 23552 [Note] RSA private key file not found: /app/mysql-5.6.50/data//private_key.pem. Some authentication plugins will not work. 2024-08-07 14:00:39 23552 [Note] RSA public key file not found: /app/mysql-5.6.50/data//public_key.pem. Some authentication plugins will not work. 2024-08-07 14:00:40 23552 [Note] Binlog end 2024-08-07 14:00:40 23552 [Note] InnoDB: FTS optimize thread exiting. 2024-08-07 14:00:40 23552 [Note] InnoDB: Starting shutdown... 2024-08-07 14:00:41 23552 [Note] InnoDB: Shutdown completed; log sequence number 1625977 OK
Filling help tables...2024-08-07 14:00:41 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details). 2024-08-07 14:00:41 0 [Note] Ignoring --secure-file-priv value as server is running with --bootstrap. 2024-08-07 14:00:41 0 [Note] /app/mysql-5.6.50/bin/mysqld (mysqld 5.6.50) starting as process 23574 ... 2024-08-07 14:00:41 23574 [Note] InnoDB: Using atomics to ref count buffer pool pages 2024-08-07 14:00:41 23574 [Note] InnoDB: The InnoDB memory heap is disabled 2024-08-07 14:00:41 23574 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins 2024-08-07 14:00:41 23574 [Note] InnoDB: Memory barrier is not used 2024-08-07 14:00:41 23574 [Note] InnoDB: Compressed tables use zlib 1.2.11 2024-08-07 14:00:41 23574 [Note] InnoDB: Using Linux native AIO 2024-08-07 14:00:41 23574 [Note] InnoDB: Using CPU crc32 instructions 2024-08-07 14:00:41 23574 [Note] InnoDB: Initializing buffer pool, size = 128.0M 2024-08-07 14:00:41 23574 [Note] InnoDB: Completed initialization of buffer pool 2024-08-07 14:00:41 23574 [Note] InnoDB: Highest supported file format is Barracuda. 2024-08-07 14:00:41 23574 [Note] InnoDB: 128 rollback segment(s) are active. 2024-08-07 14:00:41 23574 [Note] InnoDB: Waiting for purge to start 2024-08-07 14:00:41 23574 [Note] InnoDB: 5.6.50 started; log sequence number 1625977 2024-08-07 14:00:41 23574 [Note] RSA private key file not found: /app/mysql-5.6.50/data//private_key.pem. Some authentication plugins will not work. 2024-08-07 14:00:41 23574 [Note] RSA public key file not found: /app/mysql-5.6.50/data//public_key.pem. Some authentication plugins will not work. 2024-08-07 14:00:41 23574 [Note] Binlog end 2024-08-07 14:00:41 23574 [Note] InnoDB: FTS optimize thread exiting. 2024-08-07 14:00:41 23574 [Note] InnoDB: Starting shutdown... 2024-08-07 14:00:43 23574 [Note] InnoDB: Shutdown completed; log sequence number 1625987 OK
To start mysqld at boot time you have to copy support-files/mysql.server to the right place for your system
PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER ! To do so, start the server, then issue the following commands:
which will also give you the option of removing the test databases and anonymous user created by default. This is strongly recommended for production servers.
See the manual for more instructions.
You can start the MySQL daemon with:
cd . ; /app/mysql-5.6.50/bin/mysqld_safe &
You can test the MySQL daemon with mysql-test-run.pl
cd mysql-test ; perl mysql-test-run.pl
Please report any problems at http://bugs.mysql.com/
The latest information about MySQL is available on the web at
http://www.mysql.com
Support MySQL by buying support/licenses at http://shop.mysql.com
New default config file was created as /app/mysql-5.6.50/my.cnf and will be used by default by the server when you start it. You may edit this file to change server settings
WARNING: Default config file /etc/my.cnf exists on the system This file will be read by default by the MySQL server If you do not want to use this, either remove it, or use the --defaults-file argument to mysqld_safe when starting the server
#连接数据库 msyql Welcome to the MySQL monitor. Commands end with ; or \g. Type 'help;' or '\h'forhelp. Type '\c' to clear the current input statement. mysql>
#报错 FATAL ERROR: please install the following Perl modules before executing /app/mysql-5.6.50/scripts/mysql_install_db: Data::Dumper #解决方法是安装autoconf库和libaio库文件 yum -y install autoconf libaio-devel
#再次执行初始化数据库操作 [root@db01 ~]# /app/mysql-5.6.50/scripts/mysql_install_db --user=mysql --basedir=/app/mysql-5.6.50 --datadir=/app/mysql-5.6.50/data Installing MySQL system tables...2024-08-07 14:00:39 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details). 2024-08-07 14:00:39 0 [Note] Ignoring --secure-file-priv value as server is running with --bootstrap. 2024-08-07 14:00:39 0 [Note] /app/mysql-5.6.50/bin/mysqld (mysqld 5.6.50) starting as process 23552 ... 2024-08-07 14:00:39 23552 [Note] InnoDB: Using atomics to ref count buffer pool pages 2024-08-07 14:00:39 23552 [Note] InnoDB: The InnoDB memory heap is disabled 2024-08-07 14:00:39 23552 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins 2024-08-07 14:00:39 23552 [Note] InnoDB: Memory barrier is not used 2024-08-07 14:00:39 23552 [Note] InnoDB: Compressed tables use zlib 1.2.11 2024-08-07 14:00:39 23552 [Note] InnoDB: Using Linux native AIO 2024-08-07 14:00:39 23552 [Note] InnoDB: Using CPU crc32 instructions 2024-08-07 14:00:39 23552 [Note] InnoDB: Initializing buffer pool, size = 128.0M 2024-08-07 14:00:39 23552 [Note] InnoDB: Completed initialization of buffer pool 2024-08-07 14:00:39 23552 [Note] InnoDB: The first specified data file ./ibdata1 did not exist: a new database to be created! 2024-08-07 14:00:39 23552 [Note] InnoDB: Setting file ./ibdata1 size to 12 MB 2024-08-07 14:00:39 23552 [Note] InnoDB: Database physically writes the file full: wait... 2024-08-07 14:00:39 23552 [Note] InnoDB: Setting log file ./ib_logfile101 size to 48 MB 2024-08-07 14:00:39 23552 [Note] InnoDB: Setting log file ./ib_logfile1 size to 48 MB 2024-08-07 14:00:39 23552 [Note] InnoDB: Renaming log file ./ib_logfile101 to ./ib_logfile0 2024-08-07 14:00:39 23552 [Warning] InnoDB: New log files created, LSN=45781 2024-08-07 14:00:39 23552 [Note] InnoDB: Doublewrite buffer not found: creating new 2024-08-07 14:00:39 23552 [Note] InnoDB: Doublewrite buffer created 2024-08-07 14:00:39 23552 [Note] InnoDB: 128 rollback segment(s) are active. 2024-08-07 14:00:39 23552 [Warning] InnoDB: Creating foreign key constraint system tables. 2024-08-07 14:00:39 23552 [Note] InnoDB: Foreign key constraint system tables created 2024-08-07 14:00:39 23552 [Note] InnoDB: Creating tablespace and datafile system tables. 2024-08-07 14:00:39 23552 [Note] InnoDB: Tablespace and datafile system tables created. 2024-08-07 14:00:39 23552 [Note] InnoDB: Waiting for purge to start 2024-08-07 14:00:39 23552 [Note] InnoDB: 5.6.50 started; log sequence number 0 2024-08-07 14:00:39 23552 [Note] RSA private key file not found: /app/mysql-5.6.50/data//private_key.pem. Some authentication plugins will not work. 2024-08-07 14:00:39 23552 [Note] RSA public key file not found: /app/mysql-5.6.50/data//public_key.pem. Some authentication plugins will not work. 2024-08-07 14:00:40 23552 [Note] Binlog end 2024-08-07 14:00:40 23552 [Note] InnoDB: FTS optimize thread exiting. 2024-08-07 14:00:40 23552 [Note] InnoDB: Starting shutdown... 2024-08-07 14:00:41 23552 [Note] InnoDB: Shutdown completed; log sequence number 1625977 OK
Filling help tables...2024-08-07 14:00:41 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details). 2024-08-07 14:00:41 0 [Note] Ignoring --secure-file-priv value as server is running with --bootstrap. 2024-08-07 14:00:41 0 [Note] /app/mysql-5.6.50/bin/mysqld (mysqld 5.6.50) starting as process 23574 ... 2024-08-07 14:00:41 23574 [Note] InnoDB: Using atomics to ref count buffer pool pages 2024-08-07 14:00:41 23574 [Note] InnoDB: The InnoDB memory heap is disabled 2024-08-07 14:00:41 23574 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins 2024-08-07 14:00:41 23574 [Note] InnoDB: Memory barrier is not used 2024-08-07 14:00:41 23574 [Note] InnoDB: Compressed tables use zlib 1.2.11 2024-08-07 14:00:41 23574 [Note] InnoDB: Using Linux native AIO 2024-08-07 14:00:41 23574 [Note] InnoDB: Using CPU crc32 instructions 2024-08-07 14:00:41 23574 [Note] InnoDB: Initializing buffer pool, size = 128.0M 2024-08-07 14:00:41 23574 [Note] InnoDB: Completed initialization of buffer pool 2024-08-07 14:00:41 23574 [Note] InnoDB: Highest supported file format is Barracuda. 2024-08-07 14:00:41 23574 [Note] InnoDB: 128 rollback segment(s) are active. 2024-08-07 14:00:41 23574 [Note] InnoDB: Waiting for purge to start 2024-08-07 14:00:41 23574 [Note] InnoDB: 5.6.50 started; log sequence number 1625977 2024-08-07 14:00:41 23574 [Note] RSA private key file not found: /app/mysql-5.6.50/data//private_key.pem. Some authentication plugins will not work. 2024-08-07 14:00:41 23574 [Note] RSA public key file not found: /app/mysql-5.6.50/data//public_key.pem. Some authentication plugins will not work. 2024-08-07 14:00:41 23574 [Note] Binlog end 2024-08-07 14:00:41 23574 [Note] InnoDB: FTS optimize thread exiting. 2024-08-07 14:00:41 23574 [Note] InnoDB: Starting shutdown... 2024-08-07 14:00:43 23574 [Note] InnoDB: Shutdown completed; log sequence number 1625987 OK
To start mysqld at boot time you have to copy support-files/mysql.server to the right place for your system
PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER ! To do so, start the server, then issue the following commands:
which will also give you the option of removing the test databases and anonymous user created by default. This is strongly recommended for production servers.
See the manual for more instructions.
You can start the MySQL daemon with:
cd . ; /app/mysql-5.6.50/bin/mysqld_safe &
You can test the MySQL daemon with mysql-test-run.pl
cd mysql-test ; perl mysql-test-run.pl
Please report any problems at http://bugs.mysql.com/
The latest information about MySQL is available on the web at
http://www.mysql.com
Support MySQL by buying support/licenses at http://shop.mysql.com
New default config file was created as /app/mysql-5.6.50/my.cnf and will be used by default by the server when you start it. You may edit this file to change server settings
WARNING: Default config file /etc/my.cnf exists on the system This file will be read by default by the MySQL server If you do not want to use this, either remove it, or use the --defaults-file argument to mysqld_safe when starting the server
执行完毕后 ,过程中会有两个OK [root@db01 ~]# echo $? 0
二进制安装启动失败解决
1 2 3 4 5 6 7 8 9 10 11 12 13
#启动mysql [root@db02 mysql-5.6.50]# /etc/init.d/mysqld start /etc/init.d/mysqld: line 244: my_print_defaults: command not found /etc/init.d/mysqld: line 264: cd: /usr/local/mysql: No such file or directory Starting MySQL ERROR! Couldn't find MySQL server (/usr/local/mysql/bin/mysqld_safe) 报错分析: 去/usr/local/mysql找my_print_defaults这个命令,但是发现找不到 #为啥要去这个目录去找? 源码安装时候我们指定了它的安装目录,但是我们二进制安装的MySQL,MySQL没有安装在官方默认的/usr/local/mysql目录下,我们使用二进制安装是官方指定了安装目录,所以找不到这个命令 #查看二进制安装的启动脚本 得知,官方指定默认安装位置是/usr/local
msyql Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 1 Server version: 5.6.50 Source distribution Copyright (c) 2000, 2020, 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'forhelp. Type '\c' to clear the current input statement. mysql>
编译MySQL5.7以及更高的版本时,都需要下载并引用或者直接安装boost库,否则在执行cmake命令时会报如下错误: -- Packaging as: mysql-5.7.40-Linux-x86_64 -- Looked for boost/version.hpp in and -- BOOST_INCLUDE_DIR BOOST_INCLUDE_DIR-NOTFOUND -- LOCAL_BOOST_DIR -- LOCAL_BOOST_ZIP -- Could not find (the correct version of) boost. -- MySQL currently requires boost_1_59_0 CMake Error at cmake/boost.cmake:88 (MESSAGE): You can download it with -DDOWNLOAD_BOOST=1 -DWITH_BOOST=<directory>
[root@db04 mysql-5.7.40]# bin/mysqld --initialize --user=mysql --basedir=/app/mysql-5.7.40 --datadir=/app/mysql-5.7.40/data 2024-08-07T12:41:19.116519Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details). 2024-08-07T12:41:19.599490Z 0 [Warning] InnoDB: New log files created, LSN=45790 2024-08-07T12:41:19.676071Z 0 [Warning] InnoDB: Creating foreign key constraint system tables. 2024-08-07T12:41:19.731472Z 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: 58819e51-54ba-11ef-861d-000c290f3f79. 2024-08-07T12:41:19.732381Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened. 2024-08-07T12:41:19.926326Z 0 [Warning] A deprecated TLS version TLSv1 is enabled. Please use TLSv1.2 or higher. 2024-08-07T12:41:19.926344Z 0 [Warning] A deprecated TLS version TLSv1.1 is enabled. Please use TLSv1.2 or higher. 2024-08-07T12:41:19.927081Z 0 [Warning] CA certificate ca.pem is self signed. 2024-08-07T12:41:20.019287Z 1 [Note] A temporary password is generated for root@localhost: a=G&ufhfb4=* [root@db04 mysql-5.7.40]# echo $? 0
mysql user:root password:-jDYsiuZ1?y#
启动mysql
启动失败解决
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
[root@db04 mysql-5.7.40]# service mysqld start /etc/init.d/mysqld: line 239: my_print_defaults: command not found /etc/init.d/mysqld: line 259: cd: /usr/local/mysql: No such file or directory Starting MySQL ERROR! Couldn't find MySQL server (/usr/local/mysql/bin/mysqld_safe) #和5.6启动失败一样,默认去找/usr/local/mysql下找启动命令 解决: 1) 方法一:修改脚本 :%s#/usr/local/mysql#/app/mysql-5.7.40#g 2)方法二:修改配置文件(建议) [root@db02 ~]# vim /etc/my.cnf [mysqld] basedir=/app/mysql-5.7.40 datadir=/app/mysql-5.7.40/data
1 2 3 4
#再次启动 [root@db04 mysql-5.7.40]# service mysqld start Starting MySQL.Logging to '/app/mysql-5.7.40/data/db04.err'. . SUCCESS!