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

The source code installation method of mysql

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

This article introduces the relevant knowledge of "the source code installation method of mysql". In the operation of the actual case, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

Environment

Centos6.7

Mysql5.7.12

1. Centos configure yum

Modify centos parameters

[root@centos yum.repos.d] # cat CentOS-Media.repo

# CentOS-Media.repo

# yum-- disablerepo=\ *-- enablerepo=c6-media [command]

[c6-media]

Name=CentOS-$releasever-Media

Baseurl= file:///media/CentOS/

File:///media/cdrom/

File:///media/cdrecorder/

Gpgcheck=0

Enabled=1

Gpgkey= file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6

-modify the name of the parameter file

[root@centos yum.repos.d] # mv CentOS-Base.repo CentOS-Base.repo.bak

[root@centos yum.repos.d] # mkdir / media/cdrom

[root@centos yum.repos.d] # mount / dev/cdrom / media/cdrom

[root@centos yum.repos.d] # df-h

Filesystem Size Used Avail Use% Mounted on

/ dev/mapper/vg_centos-lv_root

18g 4.9g 12G 30% /

Tmpfs 877M 68K 877M 1% / dev/shm

/ dev/sda1 477m 37m 416m 9% / boot

/ dev/sr0 3.7G 3.7g 0100% / media/cdrom

[root@centos cdrom] # yum repolist

Loaded plugins: fastestmirror, refresh-packagekit, security

Loading mirror speeds from cached hostfile

* c6-media:

Repo id repo name status

C6-media CentOS-6-Media 6575

Repolist: 6575

[root@centos cdrom] #

Second, install gcc and cmake

[root@centos soft] # yum-y install gcc*

[root@centos] # gcc-- version

Gcc (GCC) 4.4.7 20120313 (Red Hat 4.4.7-16)

Copyright (C) 2010 Free Software Foundation, Inc.

This is free software; see the source for copying conditions. There is NO

Warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

[root@centos cmake-3.5.2] #. / configure

[root@centos cmake-3.5.2] # make

[root@centos cmake-3.5.2] # make install

[root@centos cmake-3.5.2] # cmake--version

Cmake version 3.5.2

CMake suite maintained and supported by Kitware (kitware.com/cmake).

[root@centos cmake-3.5.2] # cd..

Add user groups and compile mysql software

[root@centos cmake-3.5.2] #

[root@centos cmake-3.5.2] # groupadd mysql

[root@centos cmake-3.5.2] # useradd-g mysql mysql

[root@centos cmake-3.5.2] # id mysql

Uid=500 (mysql) gid=500 (mysql) groups=500 (mysql)

[root@centos cmake-3.5.2] #

[root@centos cmake-3.5.2] #

Cmake. DCMAKE_INSTALL_PREFIX=/soft/mysql-DMYSQL_DATADIR=/soft/data-DDEFAULT_CHARSET=utf8-DDEFAULT_COLLATION=utf8_general_ci-

DMYSQL_TCP_PORT=3306-DMYSQL_USER=mysql-DDOWNLOAD_BOOST=1-DWITH_BOOST=/soft/soft/mysql-5.7.12/boost

Install the packages needed to compile mysql

[root@centos Packages] # yum-y install ncurses*

[root@centos mysql-5.7.12] # cmake. -DCMAKE_INSTALL_PREFIX=/soft/mysql-DMYSQL_DATADIR=/soft/data-DDEFAULT_CHARSET=utf8-

DDEFAULT_COLLATION=utf8_general_ci-DMYSQL_TCP_PORT=3306-DMYSQL_USER=mysql-DDOWNLOAD_BOOST=1-DWITH_BOOST=/soft/soft/mysql-

5.7.12/boost

[root@centos mysql-5.7.12] #

[root@centos mysql-5.7.12] # make

Scanning dependencies of target abi_check

[0%] Built target abi_check

.o

[100%] Linking CXX executable my_safe_process

[100%] Built target my_safe_process

[root@centos mysql-5.7.12] #

[root@centos mysql-5.7.12] #

[root@centos mysql-5.7.12] #

[root@centos mysql-5.7.12] #

[root@centos mysql-5.7.12] # make install

[0%] Built target abi_check

[0%] Built target INFO_SRC

[0%] Built target INFO_BIN

[0%] Built target zlib

[1%] Built target yassl

Note:

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

# make clean

# rm-f CMakeCache.txt

# rm-rf / etc/my.cnf

Initialize the mysql database

Create a directory and modify permissions

[root@centos soft] # chown-R root.mysql mysql

[root@centos soft] # chown-R mysql.mysql data

[root@centos soft] #

[root@centos soft] #

Copy the mysql parameter file

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

[root@centos support-files] # pwd

/ soft/mysql/support-files

Copy mysql control file

[root@centos support-files] # cp mysql.server / etc/init.d/mysql

[root@centos support-files] #

-the initialization mysql,datadir directory must be empty. This version of mysql can use mysqld to initialize mysql

[root@centos bin] # / mysqld-- user=mysql-- datadir=/soft/data-- initialize

2016-05-17T04:40:23.549193Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use--

Explicit_defaults_for_timestamp server option (see documentation for more details).

2016-05-17T04:40:23.549253Z 0 [Warning] 'NO_ZERO_DATE',' NO_ZERO_IN_DATE' and 'ERROR_FOR_DIVISION_BY_ZERO' sql modes should be used

With strict mode. They will be merged with strict mode in a future release.

2016-05-17T04:40:23.549260Z 0 [Warning] 'NO_AUTO_CREATE_USER' sql mode was not set.

2016-05-17T04:40:23.939423Z 0 [Warning] InnoDB: New log files created, LSN=45790

2016-05-17T04:40:24.004248Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.

2016-05-17T04:40:24.064255Z 0 [Warning] No existing UUID has been found, so we assume that this is the first time that this server

Has been started. Generating a new UUID: 7847398f-1be9-11e6-9461-080027604fd8.

2016-05-17T04:40:24.066031Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.

2016-05-17T04:40:24.066944Z 1 [Note] A temporary password is generated for root@localhost: h (U-s2 (RhCG*)

[root@centos bin] #

Change the root password of mysql

[root@centos data] # service mysql stop

Shutting down MySQL. [OK]

[root@centos data] #

[root@centos] # mysqld_safe-- skip-grant-tables&

[1] 18383

[root@centos] # 2016-05-17T04:45:34.890822Z mysqld_safe Logging to'/ soft/data/centos.err'.

2016-05-17T04:45:34.914605Z mysqld_safe Starting mysqld daemon with databases from / soft/data

[root@centos ~] #

[root@centos ~] # mysql

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

Your MySQL connection id is 2

Server version: 5.7.12 Source distribution

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 > use mysql

Reading table information for completion of table and column names

You can turn off this feature to get a quicker startup with-A

Database changed

Mysql > update user set authentication_string=PASSWORD ("root") where user='root'

Query OK, 1 row affected, 1 warning (0.00 sec)

Rows matched: 1 Changed: 1 Warnings: 1

Mysql > flush privileges

Query OK, 0 rows affected (0.00 sec)

Mysql >

[root@centos ~] # service mysql stop

Shutting down MySQL..2016-05-17T04:48:57.945185Z mysqld_safe mysqld from pid file / soft/data/centos.pid ended

[OK]

[1] + Done mysqld_safe-- skip-grant-tables

[root@centos ~] #

[root@centos ~] #

[root@centos ~] #

[root@centos ~] #

[root@centos ~] # service mysql start

Starting MySQL. [OK]

[root@centos ~] #

-the root password for this version of mysql needs to be reset.

[root@centos] # mysql-u root-p

Enter password:

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

Your MySQL connection id is 2

Server version: 5.7.12

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 >

Mysql > use mysql

ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.

Mysql >

Mysql > set password='root'

Query OK, 0 rows affected (0.00 sec)

Mysql >

Mysql >

Mysql > use mysql

Reading table information for completion of table and column names

You can turn off this feature to get a quicker startup with-A

Database changed

Mysql >

Mysql >

This is the end of the content of "mysql source code installation method". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

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