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

Linux source code installation mysql

2025-04-10 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

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

Source code installation mysql

Tar zxf mysql-boost-5.7.11.tar.gz

Rpm-ivh cmake-2.8.12.2-4.el6.x86_64.rpm

Yum install cmake-2.8.12.2-4.el6.x86_64.rpm-y

Cd mysql-5.7.11/

Yum install gcc-c++ ncurses-devel bison-y

Detection

[root@server2mysql-5.7.11] #

Cmake-DCMAKE_INSTALL_PREFIX=/usr/local/lnmp/mysql # installation directory

-DMYSQL_DATADIR=/usr/local/lnmp/mysql/data# database storage directory

-DMYSQL_UNIX_ADDR=/usr/local/lnmp/mysql/data/mysql.sock # Unix socket file path-DWITH_MYISAM_STORAGE_ENGINE=1 # install myisam storage engine-DWITH_INNOBASE_STORAGE_ENGINE=1# install innodb storage engine-DWITH_PARTITION_STORAGE_ENGINE=1-DENABLED_LOCAL_INFILE=1

# install database partition

-DDEFAULT_CHARSET=utf8 # uses utf8 characters

-DDEFAULT_COLLATION=utf8_general_ci

-DEXTRA_CHARSETS=all-DWITH_BOOST=boost/boost_1_59_0/

The compilation process of make & & make install## takes about an hour.

# # if there are a lot of red fonts in make install and the interface is stuck, you can simply interrupt the installation state with ctrl + C and execute make install again.

When recompiling, you need to clear old object files and cache information

Make clean

Rm-f CmakeCache.txt

Then continue with camak,make & & make install

Cd / usr/local/lnmp/mysql/bin

[root@server2 bin] # vim ~ / .bash_profile

10 PATH=$PATH:$HOME/bin:/usr/local/lnmp/mysql/bin# so that it can be filled automatically.

[root@server2 bin] # source ~ / .bash_profile# refresh, effective immediately

[root@server2 bin] # cd..

[root@server2 mysql] # cd support-files/

[root@server2 support-files] # rpm-e `rpm-qa | grep mysql`-- nodeps

Warning: / var/log/mysqld.log saved as / var/log/mysqld.log.rpmsave

Note: because this machine has installed mysql before, it is necessary to remove the environmental impact when installing the source code.

We can't yum remove directly here. Yum remove removes the dependencies of the software and causes services such as postfix to fail to start.

[root@server2 support-files] # yum install mysql-libs-y

[root@server2 support-files] # yum check

[root@server2 support-files] # / etc/init.d/postfix restart# detects whether the problems mentioned above are excluded

Close postfix: [OK]

Start postfix: [OK]

[root@server2 support-files] # rpm-qa | grep mysql

Mysql-libs-5.1.71-1.el6.x86_64

[root@server2 support-files] # cat / etc/my.cnf

[mysqld]

Datadir=/var/lib/mysql

Socket=/var/lib/mysql/mysql.sock

User=mysql

# Disabling symbolic-links is recommended to prevent assorted security risks

Symbolic-links=0

[mysqld_safe]

Log-error=/var/log/mysqld.log

Pid-file=/var/run/mysqld/mysqld.pid

[root@server2 support-files] # cp / etc/my.cnf / etc/my.cnf.bak

[root@server2 support-files] # cp my-default.cnf / etc/my.cnf

Cp: overwrite "/ etc/my.cnf"? Y

[root@server2 support-files] # file mysql.server

Mysql.server: POSIX shell script text executable

[root@server2 support-files] # cp mysql.server / etc/init.d/mysqld# replication startup script

[root@server2 mysql] # cd / var/lib/

[root@server2 lib] # / etc/init.d/mysqld status

ERROR! MySQL is not running

[root@server2 lib] # cd / usr/local/lnmp/mysql/

[root@server2 mysql] # ls

Bin COPYING docs include lib man mysql-test README share support-files

[root@server2 mysql] # ll

Total dosage 56

Drwxr-xr-x 2 root root 4096 March 22 23:38 bin

-rw-r--r-- 1 root root 17987 February 2 2016 COPYING

Drwxr-xr-x 2 root root 4096 March 22 23:37 docs

Drwxr-xr-x 3 root root 4096 March 22 23:37 include

Drwxr-xr-x 4 root root 4096 March 22 23:38 lib

Drwxr-xr-x 4 root root 4096 March 22 23:37 man

Drwxr-xr-x 10 root root 4096 March 22 23:38 mysql-test

-rw-r--r-- 1 root root 2478 February 2 2016 README

Drwxr-xr-x 28 root root 4096 March 22 23:38 share

Drwxr-xr-x 2 root root 4096 March 22 23:38 support-files

[root@server2 mysql] # grep mysql / etc/passwd# View the user information of mysql

Mysql:x:27:27:MySQL Server:/var/lib/mysql:/bin/bash

[root@server2 mysql] # grep mysql / etc/shadow

Mysql:!!:17218:

[root@server2 mysql] # chown mysql.mysql. -R# sets all the people and groups of all files in the current directory to mysql-R to indicate the return.

[root@server2 mysql] # which mysql

/ usr/local/lnmp/mysql/bin/mysql

[root@server2 mysql] # mysql_install_db-user=mysql-basedir=/usr/local/lnmp/mysql/-datadir=/usr/local/lnmp/mysql/data

2017-03-23 00:24:03 [WARNING] mysql_install_db is deprecated. Please consider switching to mysqld-initialize

# # mysql_install_db is not accepted. Let's use the command mysqld-- initialize

2017-03-23 00:24:42 [WARNING] The bootstrap log isn't empty:

2017-03-23 00:24:42 [WARNING] 2017-03-22T16:24:03.786590Z 0 [Warning]-- bootstrap is deprecated. Please consider using-initialize instead

2017-03-22T16:24:03.792333Z 0 [Warning] Changed limits: max_open_files: 1024 (requested 5000)

2017-03-22T16:24:03.792343Z 0 [Warning] Changed limits: table_open_cache: 431 (requested 2000)

[root@server2 mysql] # pwd

/ usr/local/lnmp/mysql

[root@server2 mysql] # cd data/

[root@server2 data] # rm-fr *

[root@server2 data] # cd..

[root@server2 mysql] # mysqld-initialize-user=mysql-basedir=/usr/local/lnmp/mysql/-datadir=/usr/local/lnmp/mysql/data

When the final output is as follows:

2017-03-22T16:27:58.726507Z 1 [Note] A temporary password is generated for root@localhost: W_Ad1p4htKk-## bold font is the initial login password for mysql

[root@server2 mysql] # chown root.root. -R

[root@server2 mysql] # chown mysql data-R

[root@server2 mysql] # cd data/

[root@server2 data] # ls

Auto.cnf ibdata1 ib_logfile1 performance_schema

Ib_buffer_pool ib_logfile0 mysql sys

[root@server2 mysql] # / etc/init.d/mysqld start

Starting MySQL. SUCCESS!

[root@server2 data] # ls

Auto.cnf ib_logfile1 mysql.sock server2.example.com.pid

Ib_buffer_pool ibtmp1 mysql.sock.lock sys

Ibdata1 mysql performance_schema

Ib_logfile0 mysqld_safe.pid server2.example.com.err

The error message will be recorded in the server2.example.com.err file

[root@server2 data] # mysql-p

Enter password:

Welcome to the MySQL monitor. Commands end with; or\ g.

Your MySQL connection id is 3

Server version: 5.7.11

Copyright (c) 2000, 2016, 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 > alter user root@localhost identified by 'lyitx+110';## reset password

Query OK, 0 rows affected (0.00 sec)

Mysql > show databases

+-+

| | Database |

+-+

| | information_schema |

| | mysql |

| | performance_schema |

| | sys |

+-+

4 rows in set (0.00 sec)

Mysql > exit

Bye

In this way, the mysql installation is successful!

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