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

Cmake compilation and installation of mysql5.5

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

Share

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

Compile and install Mysql5.5 in CMAKE mode

1. Compile and install MySQL5.5.32 in source code cmake mode

Install before installation:

Yum install ncurses-devel-y

Download the Mysql and cmake installation packages:

Wget http://wwwNaNake.org/files/v2.8/cmake-2.8.8.tar.gz

1.2 View the system environment

Cat / etc/redhat-release

Uname-r

Uname-m

1.3 install the cmakepackage

Tar zxf cmake-2.8.8.tar.gz

Cd cmake-2.8.8

. / configure

Gmake

Gmake install

Cd.. /

1.4 start installing mysql

1.4.1 create users and groups

Groupadd mysql

Useradd mysql-s / sbin/nologin-M-g mysql

Yum install ncurses-devel-y

1.4.2 decompress and compile MySQL

Tar zxf mysql-5.5.32.tar.gz

Cd mysql-5.5.32

Cmake-DCMAKE_INSTALL_PREFIX=/application/mysql-5.5.32\

-DMYSQL_DATADIR=/application/mysql-5.5.32/data\

-DMYSQL_UNIX_ADDR=/application/mysql-5.5.32/tmp/mysql.sock\

-DDEFAULT_CHARSET=gbk\

-DDEFAULT_COLLATION=gbk_chinese_ci\

-DENABLED_LOCAL_INFILE=ON\

-DWITH_INNOBASE_STORAGE_ENGINE=1\

-DWITH_FEDERATED_STORAGE_ENGINE=1\

-DWITH_BLACKHOLE_STORAGE_ENGINE=1\

-DWITHOUT_EXAMPLE_STORAGE_ENGINE=1\

-DWITHOUT_PARTITION_STORAGE_ENGINE=1

Make

Make install

Ln-s / application/mysql-5.5.32/ / application/mysql

If there is no error in the above operation, the installation of the MySQL software is considered successful.

1.4.3 initialization configuration MySQL

1. View the default template profile

[root@Mysqlmysql-5.5.32] # ll support-files/my*.cnf

-rw-r--r--1 root root 4759 Apr 25 18:19support-files/my-huge.cnf

-rw-r--r--1 root root 19809 Apr 25 18:19 support-files/my-innodb-heavy-4G.cnf

-rw-r--r--1 root root 4733 Apr 25 18:19support-files/my-large.cnf

-rw-r--r--1 root root 4744 Apr 25 18:19support-files/my-medium.cnf

-rw-r--r--1 root root 2908 Apr 25 18:19support-files/my-small.cnf

two。 Select a profile

/ bin/cpsupport-files/my-small.cnf / etc/my.cnf

The test environment is small, and the production environment can choose support-files/my-innodb-heavy-4G.cnf according to the hardware.

3. Configure environment variables

Echo 'export PATH=/application/mysql/bin:$PATH' > > / etc/profile

Tail-1 / etc/profile

Source / etc/profile

Echo $PATH

4. Initialize data files (error-prone steps)

# create a directory of mysql data files

Mkdir-p / application/mysql/data

# authorize mysql users to access the installation directory of mysql

Chown-R mysql.mysql / application/mysql/*

Chmod-R 1777 / tmp

# initialize the database file (if you reinitialize the database file, you must first execute: rm-fr / application/mysql/data/*)

/ application/mysql/scripts/mysql_install_db-basedir=/application/mysql--datadir=/application/mysql/data-user=mysql

Special hint:

a. An error will occur if you omit the specified datadir with mysql 5.0. 5. 1.

5. Set the normal way to start the shutdown script

Cd / application/tools/mysql-5.5.32/

# copy the mysql startup script to / etc/init.d/

Cp support-files/mysql.server / etc/init.d/mysqld

# Grant 700 permissions, that is, the script can be executed

Chmod 700 / etc/init.d/mysqld

/ etc/init.d/mysqldstart

Chkconfig mysqld on

Chkconfig-list mysqld

6. Log in to mysql

7. Simple optimization of mysql

a. Delete the test library:

Mysql > show databases

+-+

| | Database |

+-+

| | information_schema |

| | mysql |

| | performance_schema |

| | test |

+-+

4 rowsin set (0.03 sec)

Mysql > drop database test

Query OK, 0 rows affected (0.04 sec)

Mysql > show databases

+-+

| | Database |

+-+

| | information_schema |

| | mysql |

| | performance_schema |

+-+

3 rowsin set (0.00 sec)

b. Clear and modify administrator users

Mysql > select user,host from mysql.user

+-+ +

| | user | host |

+-+ +

| | root | 127.0.0.1 | |

| | root |:: 1 |

| | Mysql |

| | root | Mysql |

| | localhost |

| | root | localhost |

+-+ +

6 rowsin set (0.00 sec)

Mysql > delete from mysql.user

QueryOK, 6 rows affected (0.07 sec)

Mysql > select user,host from mysql.user

Emptyset (0.00 sec)

Mysql > grant all privileges on *. * to system@'localhost' identified by '1234' withgrant option

QueryOK, 0 rows affected (0.00 sec)

Mysql > flush privileges

QueryOK, 0 rows affected (0.00 sec)

Mysql > grant all privileges on *. * to system@'127.0.0.1' identified by '1234' withgrant option

QueryOK, 0 rows affected (0.00 sec)

Mysql > select user,host from mysql.user

+-+ +

| | user | host |

+-+ +

| | system | 127.0.0.1 | |

| | system | localhost |

+-+ +

2 rowsin set (0.00 sec)

Operation procedure:

[root@mysqltools] # cat / etc/redhat-release

CentOSrelease 6.4 (Final)

[root@mysqltools] # uname-r

2.6.32-358.el6.x86_64

[root@mysqltools] # uname-m

X86_64

[root@mysqltools] # tar zxf cmake-2.8.8.tar.gz

[root@mysqltools] # cd cmake-2.8.8

[root@mysqlcmake-2.8.8] #. / configure

CMakehas bootstrapped. Now run gmake.

[root@Mysqlcmake-2.8.8] # gmake

[root@Mysqlcmake-2.8.8] # gmake install

[root@Mysqlapplication] # groupadd mysql

[root@Mysqlapplication] # useradd mysql-s / sbin/nologin-M-g mysql

[root@Mysqltools] # tar zxf mysql-5.5.32.tar.gz

[root@Mysqltools] # cd mysql-5.5.32

[root@Mysqlmysql-5.5.32] # cmake. -DCMAKE_INSTALL_PREFIX=/application/mysql-5.5.32\

Cmake. -DCMAKE_INSTALL_PREFIX=/application/mysql-5.5.32\

-DMYSQL_DATADIR=/application/mysql-5.5.32/data\

-DMYSQL_UNIX_ADDR=/application/mysql-5.5.32/tmp/mysql.sock\

-DDEFAULT_CHARSET=gbk\

-DDEFAULT_COLLATION=gbk_chinese_ci\

-DENABLED_LOCAL_INFILE=ON\

-DWITH_INNOBASE_STORAGE_ENGINE=1\

-DWITH_FEDERATED_STORAGE_ENGINE=1\

-DWITH_BLACKHOLE_STORAGE_ENGINE=1\

-DWITHOUT_EXAMPLE_STORAGE_ENGINE=1\

-DWITHOUT_PARTITION_STORAGE_ENGINE=1

# Build files have been written to: / application/tools/mysql-5.5.32 if this indicates that cmake is successful

[root@Mysqlmysql-5.5.32] # make

[root@Mysqlmysql-5.5.32] # make install

[root@Mysqlmysql-5.5.32] # ln-s / application/mysql-5.5.32//application/mysql

[root@Mysqlmysql-5.5.32] # ll support-files/my*.cnf

-rw-r--r--1 root root 4759 Apr 25 18:19support-files/my-huge.cnf

-rw-r--r--1 root root 19809 Apr 25 18:19 support-files/my-innodb-heavy-4G.cnf

-rw-r--r--1 root root 4733 Apr 25 18:19support-files/my-large.cnf

-rw-r--r--1 root root 4744 Apr 25 18:19support-files/my-medium.cnf

-rw-r--r--1 root root 2908 Apr 25 18:19support-files/my-small.cnf

[root@Mysqlmysql-5.5.32] # cp support-files/my-small.cnf / etc/my.cnf

[root@Mysqlmysql-5.5.32] # echo 'export PATH=/application/mysql/bin:$PATH' > > / etc/profile

[root@Mysqlmysql-5.5.32] # tail-1 / etc/profile

ExportPATH=/application/mysql/bin:$PATH

[root@Mysqlmysql-5.5.32] # source / etc/profile

[root@Mysqlmysql-5.5.32] # echo $PATH

/ application/mysql/bin:/application/mysql/bin/:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin

[root@Mysqlmysql-5.5.32] # mkdir-p / application/mysql/data

[root@Mysqlmysql-5.5.32] # chown-R mysql.mysql / application/mysql/*

[root@Mysqlmysql-5.5.32] # chmod-R 1777 / tmp

[root@Mysqlmysql-5.5.32] # / application/mysql/scripts/mysql_install_db--basedir=/application/mysql-- datadir=/application/mysql/data--user=mysql

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

[root@Mysqlmysql-5.5.32] # chmod 700 / etc/init.d/mysqld

[root@Mysqlmysql-5.5.32] # chkconfig mysqld on

[root@Mysqlmysql-5.5.32] # chkconfig-- list mysqld

Mysqld 0:off 1:off 2:on 3:on 4:on 5:on 6:off

Root@Mysqlmysql-5.5.32] # mysql

Welcometo the MySQL monitor. Commands end with; or\ g.

YourMySQL connection id is 2

Serverversion: 5.5.32 Source distribution

Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.

Oracleis 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 >

Simple optimization of mysql

a. Delete the test library:

Mysql > show databases

+-+

| | Database |

+-+

| | information_schema |

| | mysql |

| | performance_schema |

| | test |

+-+

4 rowsin set (0.03 sec)

Mysql > drop database test

QueryOK, 0 rows affected (0.04 sec)

Mysql > show databases

+-+

| | Database |

+-+

| | information_schema |

| | mysql |

| | performance_schema |

+-+

3 rowsin set (0.00 sec)

b. Clear and modify administrator users

Mysql > select user,host from mysql.user

+-+ +

| | user | host |

+-+ +

| | root | 127.0.0.1 | |

| | root |:: 1 |

| | Mysql |

| | root | Mysql |

| | localhost |

| | root | localhost |

+-+ +

6 rowsin set (0.00 sec)

Mysql > delete from mysql.user

Query OK, 6 rows affected (0.07 sec)

Mysql > select user,host from mysql.user

Emptyset (0.00 sec)

Mysql > grant all privileges on *. * to system@'localhost' identified by '1234' withgrant option

Query OK, 0 rows affected (0.00 sec)

Mysql > flush privileges

Query OK, 0 rows affected (0.00 sec)

Mysql > grant all privileges on *. * to system@'127.0.0.1' identified by '1234' withgrant option

Query OK, 0 rows affected (0.00 sec)

Mysql > select user,host from mysql.user

+-+ +

| | user | host |

+-+ +

| | system | 127.0.0.1 | |

| | system | localhost |

+-+ +

2 rowsin set (0.00)

1. Problems encountered when CMAKE installs Mysql:

-- Check size of wint_t-done

-- Could NOT find Curses (missing: CURSES_LIBRARY CURSES_INCLUDE_PATH)

CMakeError at cmake/readlineNaNake:83 (MESSAGE):

Curses library not found. Please install appropriate package

Remove CMakeCache.txt and rerun cmake.OnDebian/Ubuntu, package name is libncurses5-dev, on Redhat and derivates it isncurses-devel.

CallStack (most recent call first):

Cmake/readlineNaNake:127 (FIND_CURSES)

Cmake/readlineNaNake:217 (MYSQL_USE_BUNDLED_LIBEDIT)

CMakeLists.txt:269 (MYSQL_CHECK_READLINE)

Configuring incomplete, errors occurred!

Solution:

Rm CMakeCache.txt

Yum install ncurses-devel-y

And then cmake.

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