mysql configure 参数

本文详细介绍了MySQL的编译安装配置选项,包括目录配置、程序名称调整、系统类型设置、字符集选择、功能插件选择等。通过这些配置选项,用户可以根据自身需求灵活定制MySQL的安装。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

–prefix=PREFIX install architecture-independent files in PREFIX
[/usr/local]
–exec-prefix=EPREFIX install architecture-dependent files in EPREFIX
[PREFIX]
By default, `make install’ will install all the files in
`/usr/local/bin’, `/usr/local/lib’ etc. You can specify
an installation prefix other than `/usr/local’ using `–prefix’,
for instance `–prefix=$HOME’.
For better control, use the options below.
Fine tuning of the installation directories:
–bindir=DIR user executables [EPREFIX/bin]
–sbindir=DIR system admin executables [EPREFIX/sbin]
–libexecdir=DIR program executables [EPREFIX/libexec]
–sysconfdir=DIR read-only single-machine data [PREFIX/etc]
–sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com]
–localstatedir=DIR modifiable single-machine data [PREFIX/var]
–libdir=DIR object code libraries [EPREFIX/lib]
–includedir=DIR C header files [PREFIX/include]
–oldincludedir=DIR C header files for non-gcc [/usr/include]
–datarootdir=DIR read-only arch.-independent data root [PREFIX/share]
–datadir=DIR read-only architecture-independent data [DATAROOTDIR]
–infodir=DIR info documentation [DATAROOTDIR/info]
–localedir=DIR locale-dependent data [DATAROOTDIR/locale]
–mandir=DIR man documentation [DATAROOTDIR/man]
–docdir=DIR documentation root [DATAROOTDIR/doc/PACKAGE]
–htmldir=DIR html documentation [DOCDIR]
–dvidir=DIR dvi documentation [DOCDIR]
–pdfdir=DIR pdf documentation [DOCDIR]
–psdir=DIR ps documentation [DOCDIR]

Program names:
–program-prefix=PREFIX prepend PREFIX to installed program names
–program-suffix=SUFFIX append SUFFIX to installed program names
–program-transform-name=PROGRAM run sed PROGRAM on installed program names
System types:
–build=BUILD configure for building on BUILD [guessed]
–host=HOST cross-compile to build programs to run on HOST [BUILD]
–target=TARGET configure for building compilers for TARGET [HOST]
Optional Features:
–disable-option-checking ignore unrecognized –enable/–with options
–disable-FEATURE do not include FEATURE (same as –enable-FEATURE=no)
–enable-FEATURE[=ARG] include FEATURE [ARG=yes]
–disable-dependency-tracking speeds up one-time build
–enable-dependency-tracking do not reject slow dependency extractors
–enable-shared[=PKGS] build shared libraries [default=yes]
–enable-static[=PKGS] build static libraries [default=yes]
–enable-fast-install[=PKGS]
optimize for fast installation [default=yes]
–disable-libtool-lock avoid locking (might break parallel builds)
–disable-community-features
Disable additional features provided by the user
community.
–disable-thread-safe-client
Compile the client without threads.
–enable-assembler Use assembler versions of some string
functions if available.
–enable-profiling Build a version with query profiling code (req.
community-features)
–enable-local-infile Enable LOAD DATA LOCAL INFILE (default: disabled)
–disable-grant-options Disables the use of –init-file, –skip-grant-tables and –bootstrap options
–disable-largefile Omit support for large files
–enable-debug-sync Build a version with Debug Sync Facility
Optional Packages:
–with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
–without-PACKAGE do not use PACKAGE (same as –with-PACKAGE=no)
选择字符集
–with-charset=CHARSET
Default character set, use one of:
binary
armscii8 ascii big5 cp1250 cp1251 cp1256 cp1257
cp850 cp852 cp866 cp932 dec8 eucjpms euckr gb2312 gbk geostd8
greek hebrew hp8 keybcs2 koi8r koi8u
latin1 latin2 latin5 latin7 macce macroman
sjis swe7 tis620 ucs2 ujis utf8
–with-collation=COLLATION
Default collation
–with-extra-charsets=CHARSET,CHARSET,…
Use charsets in addition to default (none, complex,
all, or a list selected from the above sets)
–without-uca Skip building of the national Unicode collations.
–with-system-type Set the system type, like “sun-solaris10″
–with-machine-type Set the machine type, like “powerpc”
–with-darwin-mwcc Use Metrowerks CodeWarrior wrappers on OS X/Darwin
–with-pic try to use only PIC/non-PIC objects [default=use both]
–with-gnu-ld assume the C compiler uses GNU ld [default=no]
–with-other-libc=DIR Link against libc and other standard libraries
installed in the specified non-standard location
overriding default. Originally added to be able to
link against glibc 2.2 without making the user
upgrade the standard libc installation.
–with-server-suffix Append value to the version string.
–with-pthread Force use of pthread library.
–with-named-thread-libs=ARG
Use specified thread libraries instead of
those automatically found by configure.
–with-named-curses-libs=ARG
Use specified curses libraries instead of
those automatically found by configure.
本地连接使用 unix套接字
–with-unix-socket-path=SOCKET
Where to put the unix-domain socket. SOCKET must be
an absolute file name.
远程tcp连接使用的端口号(多实例启动时常用)
–with-tcp-port=port-number
Which port to use for MySQL services (default 3306)
–with-mysqld-user=username
What user the mysqld daemon shall be run as.
–with-zlib-dir=no|bundled|DIR
Provide MySQL with a custom location of compression
library. Given DIR, zlib binary is assumed to be in
$DIR/lib and header files in $DIR/include.
–with-libwrap=DIR Compile in libwrap (tcp_wrappers) support
–with-pstack Use the pstack backtrace library
–with-debug Add debug code
–with-debug=full Add debug code (adds memory checker, very slow)
–with-error-inject Enable error injection in MySQL Server

- 与快速,互斥与(默认快速互斥编译被禁用)
–with-fast-mutexes Compile with fast mutexes (default is disabled)

–with-atomic-ops=rwlocks|smp|up
Implement atomic operations using pthread rwlocks or
atomic CPU instructions for multi-processor
(default) or uniprocessor configuration
选择静态编译
–with-mysqld-ldflags Extra linking arguments for mysqld
–with-client-ldflags Extra linking arguments for clients
–with-mysqld-libs Extra libraries to link with for mysqld
–with-lib-ccflags Extra CC options for libraries
–with-low-memory Try to use less memory to compile to avoid
memory limitations.
–with-comment Comment about compilation environment.
支持超大表
–with-big-tables Support tables with more than 4 G rows even on 32
bit platforms
–with-max-indexes=N Sets the maximum number of indexes per table,
default 64
–with-ssl=DIR Include SSL support
选择功能插件和引擎插件
–with-plugins=PLUGIN[[[,PLUGIN..]]]
Plugins to include in mysqld. (default is: none)
Must be a configuration name or a comma separated
list of plugins.
Available configurations are: none max max-no-ndb all
Available plugins are: partition daemon_example
ftexample archive blackhole csv example federated
heap ibmdb2i innobase innodb_plugin myisam myisammrg
ndbcluster.
–without-plugin-PLUGIN Disable the named plugin from being built.
Otherwise, for plugins which are not selected for
inclusion in mysqld will be built dynamically (if
supported)
–with-plugin-PLUGIN Forces the named plugin to be linked into mysqld
statically.
–with-ndb-sci=DIR Provide MySQL with a custom location of sci library.
Given DIR, sci library is assumed to be in $DIR/lib
and header files in $DIR/include.
–with-ndb-test Include the NDB Cluster ndbapi test programs
–with-ndb-docs Include the NDB Cluster ndbapi and mgmapi documentation
–with-ndb-port Port for NDB Cluster management server
–with-ndb-port-base Base port for NDB Cluster transporters
–without-ndb-debug Disable special ndb debug features
–with-ndb-ccflags=CFLAGS
Extra CFLAGS for ndb compile
–without-ndb-binlog Disable ndb binlog
安装客户端
–without-server Only build the client.
–with-embedded-server Build the embedded server (libmysqld).
–without-query-cache Do not build query cache.
–without-geometry Do not build geometry-related parts.
–with-embedded-privilege-control
Build parts to check user’s privileges.
Only affects embedded library.
–with-mysqlmanager Build the mysqlmanager binary: yes/no (default:
build if server is built.)
–without-docs Skip building of the documentation.
–without-man Skip building of the man pages.
–without-readline Use system readline instead of bundled copy.
–without-libedit Use system libedit instead of bundled copy.
Some influential environment variables:
CC C compiler command
CFLAGS C compiler flags
LDFLAGS linker flags, e.g. -L if you have libraries in a
nonstandard directory
LIBS libraries to pass to the linker, e.g. -l
CPPFLAGS C/C++/Objective C preprocessor flags, e.g. -I if
you have headers in a nonstandard directory
CXX C++ compiler command
CXXFLAGS C++ compiler flags
CPP C preprocessor
CXXCPP C++ preprocessor
CCAS assembler compiler command (defaults to CC)
CCASFLAGS assembler compiler flags (defaults to CFLAGS)
Use these variables to override the choices made by `configure’ or to help
it to find libraries and programs with nonstandard names/locations.
请关注Supports build,有些插件是不支持静态编译的需要在性能和功能之间取舍
Description of plugins:
=== Partition Support ===
Plugin Name: partition
Description: MySQL Partitioning Support
Supports build: static
Configurations: max, max-no-ndb
=== Daemon Example Plugin ===
Plugin Name: daemon_example
Description: This is an example plugin daemon.
Supports build: dynamic
=== Simple Parser ===
Plugin Name: ftexample
Description: Simple full-text parser plugin
Supports build: dynamic
=== Archive Storage Engine ===
Plugin Name: archive
Description: Archive Storage Engine
Supports build: static and dynamic
Configurations: max, max-no-ndb
=== Blackhole Storage Engine ===
Plugin Name: blackhole
Description: Basic Write-only Read-never tables
Supports build: static and dynamic
Configurations: max, max-no-ndb
=== CSV Storage Engine ===
Plugin Name: csv
Description: Stores tables in text CSV format
Supports build: static
Status: mandatory 强制安装
=== Example Storage Engine ===
Plugin Name: example
Description: Example for Storage Engines for developers
Supports build: dynamic
Configurations: max, max-no-ndb

=== Federated Storage Engine ===
Plugin Name: federated
Description: Connects to tables on remote MySQL servers
Supports build: static and dynamic
Configurations: max, max-no-ndb
=== Memory Storage Engine ===
Plugin Name: heap
Description: Volatile memory based tables
Supports build: static
Status: mandatory
=== IBM DB2 for i Storage Engine ===
Plugin Name: ibmdb2i
Description: IBM DB2 for i Storage Engine
Supports build: dynamic
Configurations: max, max-no-ndb
=== InnoDB Storage Engine ===
Plugin Name: innobase
Description: Transactional Tables using InnoDB
Supports build: static and dynamic
Configurations: max, max-no-ndb
=== InnoDB Storage Engine ===
Plugin Name: innodb_plugin
Description: Transactional Tables using InnoDB
Supports build: dynamic
Configurations: max, max-no-ndb
=== MyISAM Storage Engine ===
Plugin Name: myisam
Description: Traditional non-transactional MySQL tables
Supports build: static
Status: mandatory
=== MyISAM MERGE Engine ===
Plugin Name: myisammrg
Description: Merge multiple MySQL tables into one
Supports build: static
Status: mandatory
=== Cluster Storage Engine ===
Plugin Name: ndbcluster
Description: High Availability Clustered tables
Supports build: static
Configurations: max 

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/26690043/viewspace-721570/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/26690043/viewspace-721570/

### 正确应用和验证 MySQL 配置文件更改 #### 修改配置文件权限 当遇到 `World-writable config file` 警告时,表明当前的配置文件具有过于宽松的权限设置,任何用户都可以对其进行写入操作。为了安全起见,应当调整该文件的访问权限至更为严格的模式[^1]。 对于 Linux 系统而言,可以通过命令行工具来改变 `/etc/mysql/mysql.conf.d/mysqld.cnf` 文件的所有者及其所属组,并将其读写执行权限设为仅限特定用户或管理员拥有: ```bash sudo chown root:root /etc/mysql/mysql.conf.d/mysqld.cnf sudo chmod 644 /etc/mysql/mysql.conf.d/mysqld.cnf ``` 上述指令确保只有超级用户(root)能够编辑此文件,而其他普通成员仅有查看的权利。 #### 应用新配置并重启服务 完成必要的修改后,需让这些改动生效,则要停止正在运行的服务实例再重新启动它。具体做法取决于操作系统平台的不同;如果是基于 Unix 或类 Unix 的系统(如 Linux),可以利用 systemctl 来管理 MySQL 服务的状态: ```bash sudo systemctl restart mysql.service ``` 而对于 Windows 用户来说,在图形界面里通过“服务”窗口找到对应的 MySQL 进程手动点击“重启”,或者借助 PowerShell 执行相应脚本来实现自动化处理过程[^4]。 #### 使用 mysqld --validate-config 命令检验有效性 自 MySQL 5.7 开始引入了一个非常有用的特性——`mysqld --validate-config` 参数,允许开发者无需真正开启数据库就能快速检测所作设定是否存在语法错误或其他潜在风险因素。这一功能极大地方便了日常维护工作中的调试环节[^3]。 例如,可以在终端中键入下面这条语句来进行初步筛查: ```bash /usr/sbin/mysqld --defaults-file=/path/to/your/my.cnf --validate-config ``` 如果一切正常的话,屏幕上不会有任何输出信息返回给调用方;反之则会显示出错详情供进一步排查之用。 #### 查询实时变量确认变更成果 最后一步是要核实那些被更新过的参数确实已经被采纳进来。此时可采用客户端程序连接到目标主机上的 MySQL 实例内部查询全局状态表单内的记录条目,以此作为最终依据证明先前所做的努力达到了预期效果[^2]。 以检查 SSL 设置为例,假设之前已在 my.cnf 中指定了禁用加密传输层协议(TLS),那么现在就可以登录 shell 后台发出如下 SQL 请求获得确切答案: ```sql SHOW GLOBAL VARIABLES LIKE '%ssl%'; ``` 理想状况下,所有与 SSL 相关联的关键字均为空白字符串或者是显式的零值形式表示未启用该项功能。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值