配置文件路径:
/data/mysql/mysql3306/my.cnf
[client]
port = 3306
[mysql]
auto-rehash
prompt="\u@\h:\p [\d]>"
#pager="less -i -n -S"
#tee=/opt/mysql/query.log
[root@edu ~]# mysql -S /tmp/mysql3306.sock -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or g.
Your MySQL connection id is 23
Server version: 5.7.22-log MySQL Community Server (GPL)
Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or 'h' for help. Type 'c' to clear the current input statement.
mysql>
分析启动过程:
[root@zstedu ~]# strace /usr/local/mysql/bin/mysql --print-defaults
execve("/usr/local/mysql/bin/mysql", ["/usr/local/mysql/bin/mysql", "--print-defaults"], [/* 22 vars */]) = 0
brk(NULL) = 0xa6f000
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f2cbd222000
access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory)
open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=22349, ...}) = 0
mmap(NULL, 22349, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f2cbd21c000
close(3) = 0
open("/lib64/libpthread.so.0", O_RDONLY|O_CLOEXEC) = 3
read(3, "177ELF211 3 >