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

Mysql database installation tutorial using source code

2025-03-29 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

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

Below, I will give you a brief introduction to the mysql database installation tutorial using source code. Have you learned about similar topics before? If you are interested, let's take a look at this article. I believe it will be of some help to you after reading the mysql database installation tutorial with source code.

Mysql database is installed with source code

[root@server ~] # wget-c http://mirrors.sohu.com/mysql/MySQL-5.7/mysql-5.7.17.tar.gz[root@server ~] # tar-zxf mysql-5.7.17.tar.gz [root@server ~] # cd mysql-5.7.17 [root@server mysql-5.7.17] # yum install cmake ncurses-devel-y [root@server mysql-5.7.17] # cmake\-DCMAKE_INSTALL_PREFIX=/usr/ Local/mysql\-DMYSQL_DATADIR=/usr/local/mysql/data\-DSYSCONFDIR=/etc\-DWITH_MYISAM_STORAGE_ENGINE=1\-DWITH_INNOBASE_STORAGE_ENGINE=1\-DWITH_MEMORY_STORAGE_ENGINE=1\-DWITH_READLINE=1\-DMYSQL_UNIX_ADDR=/usr/local/mysql/mysql.sock\ # specify the suite word path-DMYSQL_TCP_PORT=3306\-DENABLED_LOCAL_INFILE=1\-DWITH_PARTITION_STORAGE_ENGINE=1\-DEXTRA_CHARSETS=all\-DDEFAULT_CHARSET=utf8\ # set character set-DDEFAULT_COLLATION=utf8_general_ci\ # set character check set-DDOWNLOAD_BOOST=1\-DWITH_BOOST=/usr/local/boost # specify the Boost extension source code path

CMake Warning:

Manually-specified variables were not used by the project:

WITH_MEMORY_STORAGE_ENGINE

WITH_READLINE

-- Build files have been written to: / root/mysql-5.7.17

The above results indicate that the pre-compilation is successful!

[root@server mysql-5.7.17] # make-j grep 'processor' / proc/cpuinfo | wc-l [root@server mysql-5.7.17] # make-j grep' processor' / proc/cpuinfo | wc-l install

Check whether the system already has a mysql user, and if not, create

[root@server mysql-5.7.17] # cat / etc/passwd | grep mysql [root@server mysql-5.7.17] # cat / etc/group | grep mysql

Create a mysql user (but cannot log in to the system using a mysql account)

[root@server mysql-5.7.17] # groupadd mysql [root@server mysql-5.7.17] # useradd-g mysql- s / sbin/nologin mysql

Modify permissions

[root@server mysql-5.7.17] # chown-R mysql:mysql / usr/local/mysql [root@server mysql-5.7.17] # cp / usr/local/mysql/support-files/my-default.cnf / etc/my.cnf [root@server mysql-5.7.17] # vim / etc/my.cnf# [mysqld] basedir=/usr/local/mysqldatadir=/usr/local/mysql/datasocket=/ Usr/local/mysql/mysql.sockuser=mysql#innodb_force_recovery=6# Disabling symbolic-links is recommended to prevent assorted security riskssymbolic-links=0log-bin=mysql-binserver-id = 1auto_increment_offset=1auto_increment_increment=2# Settings user and group are ignored when systemd is used.# If you need to run mysqld under a different user or group # customize your systemd unit file for mariadb according to the# instructions in http://fedoraproject.org/wiki/Systemd[mysqld_safe]log-error=/usr/local/mysql/mysqld.logpid-file=/usr/local/mysql/mysqld.pid## include all files from the config directory#!includedir / etc/my.cnf.d [root@server mysql-5.7.17] # cp / usr/local/mysql/support-files/mysql.server / etc/init.d/mysqld [root@server mysql-5.7 .17] # vim / etc/init.d/mysqld# add installation directory and data directory basedir=/usr/local/mysqldatadir=/usr/local/mysql/data [root@server mysql-5.7.17] # chkconfig-- add mysqld [root@server mysql-5.7.17] # chkconfig-- level 35 mysqld on

Enter / etc/profile to set the environment variable

[root@server mysql-5.7.17] # vim / etc/profileexport PATH=/usr/local/mysql/bin:$PATH # add [root@server mysql-5.7.17] # source / etc/profile at the end

Enter the installation path, execute the initialization configuration script, and create the database and table that comes with the system.

# previous version of mysql5.7 initialization configuration table command:

# script/mysql_install_db-user=mysql-datadir=/usr/local/mysql/data-basedir=/usr/local/mysql/

# mysql5.7 has been abandoned, and there is no script directory, you can use the following

# [root@server mysql-5.7.17] # / usr/local/mysql/bin/mysqld-initialize-user=mysql-datadir=/usr/local/mysql/data-basedir=/usr/local/mysql/

The generated initial password is located at:

Method 1:

[root@server mysql-5.7.17] # grep 'temporary password' / var/log/mysqld.log 2016-07-08T02:25:46.311098Z 1 [Note] A temporary password is generated for root@localhost: MtPqF0/oN5zo

That is, the initial password is MtPqF0/oN5zo (the password is randomly generated, and each machine generates a different password)

Method 2:

[root@server mysql-5.7.17] # cat / root/.mysql_secret# The random password set for the root userat Fri Jan 10 20:00:34 2014 (local time): aJqZsA2m

The aJqZsA2m here is the generated root random password.

Next, start the database and reset the root password

[root@server mysql-5.7.17] # / etc/init.d/mysqld start [root@server mysql-5.7.17] # mysql- uroot-pEnter password: # enter the random password just now to link to the database mysql > ALTER USER 'root'@'localhost' IDENTIFIED BY' new password'

What do you think of this article about using source code installation tutorials for mysql databases? is there anything to gain? If you want to know more about it, you can continue to follow our industry information section.

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