2.Skill Check: Installing and Upgrading MySQL
Which command makes mysqld start automatically when the host reboots?
# systemctl enable mysqld.service
# systemctl daemon-reload
# systemctl restart mysqld
# systemctl start mysqld
What does the RPM installation process for MySQL do? (Choose two)
It creates the default my.cnf file
It sets up the mysql user and group in the operating system
It provides a temporary password for the root account
It registers system startup scripts for MySQL services
It creates the default root@localhost account
Which Linux MySQL server installation directories are the base directories? (Choose two)
/var/log
/etc
/var/lib/mysql
/usr/bin
/usr/sbin
What is the purpose of the mysql_config_editor utility? (Choose two)
It reads and summarizes the contents of MySQL slow query log files.
It manages login paths to connect command-line clients to the MySQL server.
It reads and replays the contents of binary log files.
It enables users to store authentication credentials in the .mylogin.cnf file.
It creates TLS keys and certificates.
When installing MySQL from a binary archive distribution, you must add ‘/usr/local/mysql/bin’ to the user’s executable search path. Which line must you add to the ~/.bashrc file?
export PATH=$PATH:/usr/local/mysql/bin
pid-file=/var/run/mysqld/mysqld.pid
datadir=/var/lib/mysql/bin
ExecStart=/usr/local/mysql/bin/mysqld –defaultsfile=/etc/my.cnf –daemonize
Which command creates a symbolic link during the installation phase to the extracted directory of MySQL?
# ln -s /opt/mysql* /usr/local/mysql
# cp /labs/my.cnf /etc/my.cnf
# mv opt/mysql /usr/local/mysql
# ls -l /usr/local/mysql
Which command is used to stop MySQL server?
mysqladmin –login-path=admin shutdown
mysqladmin -uroot -p flush-hosts
mysqladmin -uroot -p stop-slave
mysqladmin -uroot -p shutdown
答案:
Which command makes mysqld start automatically when the host reboots?
# systemctl enable mysqld.service
What does the RPM installation process for MySQL do? (Choose two)
It sets up the mysql user and group in the operating system
It registers system startup scripts for MySQL services
说明:
MySQL RPM Installation Process
• The RPM installation performs the following tasks:
– Extracts RPM files to their default locations
– Registers SysV init or systemd startup scripts
– Sets up the mysql user and group in the operating system
— The MySQL server process runs as the mysql user.
• When you start the service for the first time using service mysqld
start or systemctl start mysqld, MySQL:
– Creates the data directory and the default my.cnf file
— These files are owned by the mysql user and group.
– Creates the default root@localhost account
– Sets up a random temporary password for the root account and
writes that password to the error log file (/var/log/mysqld.log)
— You must change the password before you can use MySQL.
Which Linux MySQL server installation directories are the base directories? (Choose two)
/usr/bin
/usr/sbin
说明:
Data Directory
• /var/lib/mysql is where the server stores databases. This directory is configured when
you (or the installation process) run mysqld –initialize. The InnoDB log files, undo
tablespaces, and system tablespace are in this directory. It also includes a subdirectory for
each database. This includes the mysql directory, which contains system tables including
the grant tables. MySQL 8.0 stores the data dictionary in mysql.ibd tablespace using
InnoDB storage engine.
Base Directory
• /usr/sbin contains the main server executable, mysqld.
• /usr/bin contains client programs and scripts such as mysql, my_print_defaults,
mysqladmin, mysqlcheck, and mysqlimport.
Other Directories
• /var/lib/mysql-files is configured in the secure_file_priv variable for storing
import and export data files.
• /var/lib/mysql-keyring is allocated for storing keyring files.
• /etc and /var/log are standard Linux directories for configuration files and log files. The
/etc/my.cnf file is read by the MySQL server process (mysqld).
• The systemd startup script is stored in the default systemd directory.
What is the purpose of the mysql_config_editor utility? (Choose two)
It manages login paths to connect command-line clients to the MySQL server.
It enables users to store authentication credentials in the .mylogin.cnf file.
说明:
mysql_config_editor
Use mysql_config_editor to create encrypted option files.
• Store user, password, and host options in a dedicated option file:
– .mylogin.cnf in the current user’s home directory
– To specify an alternative file name, set the MYSQL_TEST_LOGIN_FILE environment
variable.
• The .mylogin.cnf file contains login paths.
– They are similar to option groups.
– Each login path contains authentication information for a single identity.
– Clients refer to a login path with the –login-path (or -L) command-line option:
– Protect the file from being read by other users. Anyone who can read the file can use
the credentials and is able to obtain the plain text passwords.
When installing MySQL from a binary archive distribution, you must add ‘/usr/local/mysql/bin’ to the user’s executable search path. Which line must you add to the ~/.bashrc file?
export PATH=$PATH:/usr/local/mysql/bin
Which command creates a symbolic link during the installation phase to the extracted directory of MySQL?
# ln -s /opt/mysql* /usr/local/mysql
Which command is used to stop MySQL server?
mysqladmin -uroot -p shutdown
No Responses (yet)
Stay in touch with the conversation, subscribe to the RSS feed for comments on this post.