Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Introduction to the use of MySQL initialization script mysql_install_db and option parameters

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

Mysql_install_db is an initialization script that is placed at... / mysql/scripts by default.

This script can be used on any operating system with perl. Prior to version 5.6.8, the script was a shell script and could only be used on the unix platform.

After 5.7.6, the script will also be removed.

The official introduction to it is: Initialize MySQL Data Directory

When you finish installing mysql server, you usually execute this script to initialize the database.

Running this script initializes the data directory of mysql and creates those system tables.

The system tablespace is also initialized and the innodb table is associated with the data structure.

As of version 5.6.8, on the unix platform, mysql_install_db created a default parameter file named "my.cnf" in the base installation directory.

The my.cnf is created based on. / mysql/support-files/my-default.cnf.

If my.cnf already exists, the script assumes that my.cnf is in use and creates a file named "my-new.cnf".

Examples of usage:

. / mysql_install_db-- user=mysql-- basedir=/usr/local/mysql-- datadir=/data/mysql3306

Where-- user is the running user of the mysqld service

-- basedir and-- datadir represent the installation directory and data storage directory of mysql, respectively

After version 5.6.8, after initialization in this way, the root password will be stored in / root/.mysql_secret

For more information, please see-- random-passwords parameter.

Other options: (there may be discrepancies in the manual translation of bloggers. Please refer to the manual for details)

-- help

Display help information

-- basedir=path

The path to the mysql installation directory

-- builddir=path

The path to the build directory for out-of-source builds.

-- cross-bootstrap

For internal use.

-- datadir=path

The path to the mysql data directory

-- defaults-extra-file=file_name

Before reading the global options file and before reading the user options file, read this file (options file), if the file does not exist, an error will be thrown. (unix platform only)

-- defaults-file=file_name

Use the options file provided, and a prompt will be thrown if the file does not exist.

-- force

When dns is not available, it will be replaced by an ip address.

-- keep-my-cnf

Added in 5.6.20, mysql_install_db saves any existing my.cnf files and does not create a new default my.cnf file.

-- ldata=path

Synonymous with-- datadir.

-- no-defaults

Does not read any options file, which is used when mysql_install_db starts if the startup fails because an unknown parameter is read.

-- random-passwords

This option was added in 5.6.8, and on the unix platform, it adds more security to the mysql installation.

The program initializes a random password for root, writes it to the .MySQL _ secret file, and places it in the corresponding user's home directory.

If the. MySQL _ secret file already exists, the new password information will be appended, and each password will have a timestamp information. The default permission for this file is 600.

And there are no anonymous mysql users.

When you newly install mysql through RPM and use mysql_install_db, the-- random-passwords option is called by default. (except for upgrades)

On 5.6.9 when Solaris PKG is newly installed and mysql_install_db is used,-- random-passwords is also called. (except for upgrades)

When installing with binary or source code, you can manually add the-random-passwords option when using mysql_install_db.

-- rpm

For internal use.

-- skip-name-resolve

When creating authorization tables, use the ip address instead of the host name, which is useful if your DNS doesn't work.

-- srcdir=path

For internal use.

-- user=user_name

The user name of the system running mysqld, and the owner of files and directories created through mysqld will be this user.

-- verbose

Verbose mode to print more information about this program.

-- windows

For internal use, 5.7.5 will be removed.

Author's official account on Wechat (continuously updated)

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report