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

How to use cmake to compile and install MySQL5.5.32 under CentOS6.7

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

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

Today, I would like to share with you how to use cmake to compile and install MySQL5.5.32 under CentOS6.7. The content is detailed and the logic is clear. I believe most people still know too much about this knowledge, so share this article for your reference. I hope you can get something after reading this article.

Cmake is a cross-platform open source meta-build system that can build, test, and package software. It can be used to support a variety of native build environments, including make, Apple's xcode and Microsoft's Visual Studio.

Install the cmake compilation environment

1.1 install gcc gcc-c++ using yum

[root@lenovo ~] # yum install gcc-c++ gcc- y

1.2 Unzip the camke source file and put the cmake source file in the / tmp/ folder

[root@lenovo ~] # cd / tmp [root@lenovo ~] # tar-xf cmake-2.8.8.tar.gz

1.3Compiler and install cmake

[root@lenovo ~] # cd cmake-2.8.8 [root@lenovo ~] #. / configure [root@lenovo ~] # make [root@lenovo ~] # make install

So far the cmake compilation environment has been installed successfully

Second, install MySQL5.5.32

2.1 install the mysql dependency package

[root@lenovo ~] # yum install ncurses-devel-y

2.2 create mysql users and user groups

[root@lenovo ~] # groupadd mysql [root@lenovo ~] # useradd-g mysql mysql

2.3 create a mysql installation directory

[root@lenovo] # mkdir-p / usr/local/mysql/

2.4 create a data storage directory

[root@lenovo] # mkdir-p / data/mysql/

2.5 Grant permissions to the data storage directory

[root@lenovo] # chown mysql.mysql-R / data/mysql/

2.6.Unzip the MySQL source code package and put the MySQL5.5.32 source files in the / tmp/ folder

[root@lenovo ~] # cd / tmp [root@lenovo ~] # tar-xf mysql-5.5.32.tar.gz

2.7 compile and install mysql5.5.32

[root@lenovo ~] # cd mysql-5.5.32

Enter the following command

[root@lenovo ~] cmake-DCMAKE_INSTALL_PREFIX=/usr/local/mysql\-DMYSQL_UNIX_ADDR=/data/mysql/mysql.sock\-DDEFAULT_CHARSET=utf8\-DDEFAULT_COLLATION=utf8_general_ci\-DWITH_EXTRA_CHARSETS:STRING=utf8 Gbk\-DWITH_MYISAM_STORAGE_ENGINE=1\-DWITH_INNOBASE_STORAGE_ENGINE=1\-DWITH_MEMORY_STORAGE_ENGINE=1\-DWITH_READLINE=1\-DENABLED_LOCAL_INFILE=1\-DMYSQL_DATADIR=/data/mysql\-DMYSQL_USER=mysql\-DMYSQL_TCP_PORT= 3306 [root @ lenovo ~] # make [root@lenovo ~] # make install

2.8 copy profile

[root@lenovo ~] # cp support-files/my-medium.cnf / etc/my.cnf

2.9 initialize the database

[root@lenovo] # chmod 755 scripts/mysql_install_ DB [root @ lenovo ~] # scripts/mysql_install_db\-- user=mysql\-- basedir=/usr/local/mysql\-- datadir=/data/mysql/

Note: basedir configures environment variables for mysql installation path datadir for database file storage path 2.10

[root@lenovo ~] # vim / etc/profile

Add PATH=/usr/local/mysql/bin:$PATH note in the / etc/profile file: there can be no spaces on both sides of the "=" Note: if you change the PATH by modifying the profile file, you must log in again to take effect, and the following method can simplify the work: if you modify the / etc/profile, then execute source profile or execute the point command: / etc/profile, the value of PATH will take effect immediately. The principle of this method is to execute the / etc/profile shell script again, note that it is not possible to use sh / etc/profile, because sh is executed in a child shell process, and even if PATH changes, it will not be reflected in the current environment, but source is executed in the current shell process, so we can see the change in PATH.

[root@lenovo ~] # source / etc/profile

2.11 View current environment variables

[root@lenovo ~] # echo $PATH

Now you can see that there are more / usr/local/mysql/bin in the environment variables:

/ usr/local/mysql/bin:/usr/lib64/qt-3.3/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin

Mysql compilation and installation is successful so far.

Start the mysql database

3.1 start the mysql service

[root@lenovo] # cp support-files/mysql.server / etc/init.d/mysqld [root@lenovo ~] # chmod 755 / etc/init.d/mysqld [root@lenovo ~] # / etc/init.d/mysqld start / /

After the server switch is started, use the ps-ef | grep mysql command to check whether it is started or not.

[root@lenovo ~] # ps-ef | grep mysql

3.2 set the password for root users

[root@lenovo] # mysqladmin-u root password' yourpassword'

3. Enter mysql

[root@lenovo] # mysql-u root-p / /

Access to the database

Mysql > use mysqlmysql > select user,password,host from user;mysql > update user set host = '192.168%' where user = '127.0.0.1' candidate MySQL > grant all privileges on *. * to root@'%' identified by "root"

/ / grant permissions to remote connections logged in with root@ip to connect to the database. The cause of common problems that cannot be connected remotely. And set the password of the remote login user to root

Mysql > flush privileges;mysql > quit above are all the contents of the article "how to use cmake to compile and install MySQL5.5.32 under CentOS6.7". Thank you for reading! I believe you will gain a lot after reading this article. The editor will update different knowledge for you every day. If you want to learn more knowledge, please pay attention to the industry information channel.

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

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report