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 method of using cmake to install mysql on linux

2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

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

Editor to share with you how to use cmake to install mysql on linux. I hope you will gain a lot after reading this article. Let's discuss it together.

Methods: 1, install the ncurses-devel dependent package; 2, download and extract the mysql package; 3, use the cd command to enter the mysql folder, use the cmake command for configuration resolution; 4, use the "make & & make install" command to install mysql.

First, install cmake

1. Decompress the cmake package

[root@mysql tools] # tar-zvxf cmake-2.8.8.tar.gz [root@mysql tools] # lscmake-2.8.8 cmake-2.8.8.tar.gz mysql-5.5.16.tar.gz scripts

2. Analysis

[root@mysql tools] # cd cmake-2.8.8 [root@mysql cmake-2.8.8] #. / configure-CMake 2.8.8, Copyright 2000-2009 Kitware Inc.Found GNU toolchainC compiler on this system is: gccC++ compiler on this system is: g++Makefile processor on this system is: gmakeg++ is GNU compilerg++ has STL in std:: namespaceg++ has ANSI streamsg++ has streams in std:: namespace

3. Installation

[root@mysql cmake-2.8.8] # echo $? "if the return value is 0, the execution is successful, and if the return value is 1, the execution failed [root@mysql cmake-2.8.8] # gmake & & gmake installScanning dependencies of target cmIML_test [1] Building C object Utilities/KWIML/test/CMakeFiles/cmIML_test.dir/test.c.o [1] Building C object Utilities/KWIML/test/CMakeFiles/cmIML_test.dir/test_ABI_C.c.o [1] Building C object Utilities/KWIML/test/CMakeFiles/cmIML_test.dir/test_INT_C.c.o [1] Building C object Utilities/KWIML / test/CMakeFiles/cmIML_test.dir/test_include_C.c.o [2] Building CXX object Utilities/KWIML/test/CMakeFiles/cmIML_test.dir/test_ABI_CXX.cxx.o [2] Building CXX object Utilities/KWIML/test/CMakeFiles/cmIML_test.dir/test_INT_CXX.cxx.o [2] Building CXX object Utilities/KWIML/test/CMakeFiles/cmIML_test.dir/test_include_CXX.cxx.o

Start installing mysql

1. First, you need to install (ncurses-devel) the dependency package

[root@mysql cmake-2.8.8] # cd... [root@mysql tools] # yum-y install ncurses-develLoaded plugins: fastestmirrorLoading mirror speeds from cached hostfilebase: mirrors.zju.edu.cnextras: centos.ustc.edu.cnupdates: mirrors.zju.edu.cnResolving Dependencies- > Running transaction check- > tools ncurses-devel.x86_64 0v5.9-14.20130511.el7_4 will be installed# check # [root@mysql tools] # rpm-qa after installation is complete | Grep ncurses-develncurses-devel-5.9-14.20130511.el7_4.x86_64 [root@mysql tools] #

2. Decompress the mysql package

[root@mysql tools] # tar-zvxf mysql-5.5.16.tar.gz [root@mysql tools] # lscmake-2.8.8 cmake-2.8.8.tar.gz mysql-5.5.16 mysql-5.5.16.tar.gz scripts [root@mysql tools] #

3. Create a virtual user

[root@mysql tools] # useradd mysql-s / sbin/nologin-M [root@mysql tools] # id mysqluid=1000 (mysql) gid=1000 (mysql) groups=1000 (mysql) [root@mysql tools] #

4. Configuration resolution

[root@mysql tools] # cd mysql-5.5.16 [root@mysql mysql-5.5.16] # [root@mysql mysql-5.5.16] # cmake. -DCMAKE_INSTALL_PREFIX=/usr/local/mysql-5.5.16-DMYSQL_DATADIR=/usr/local/mysql-5.5.16/data-DMYSQL_UNIX_ADDR=/usr/local/mysql-5.5.16/tmp/mysql.sock-DDEFAULT_CHARSET=utf8-DDEFAULT_COLLATION=utf8_general_ci-DEXTRA_CHARSETS=gbk,gb2312,utf8 Ascii-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-DWITH_FAST_MUTEXES=1-DWITH_ZLIB=bundled-DENABLED_LOCAL_INFILE=1-DWITH_READLINE=1-DWITH_EMBEDDED_SERVER=1-DWITH_DEBUG=0

5. Installation

[root@mysql mysql-5.5.16] # make & & make installScanning dependencies of target INFO_BIN [0%] Built target INFO_BINScanning dependencies of target INFO_SRC [0%] Built target INFO_SRCScanning dependencies of target abi_check [0%] Built target abi_checkScanning dependencies of target zlib

6. Create a soft connection

[root@mysql mysql-5.5.16] # ln-s / usr/local/mysql-5.5.16/ / usr/local/mysql [root@mysql mysql-5.5.16] # readlink / usr/local/mysql/usr/local/mysql-5.5.16/ [root@mysql mysql-5.5.16] #

7. Configure the environment

[root@mysql mysql-5.5.16] # cd... [root@mysql tools] # echo 'export PATH=/usr/local/mysql/bin:$PATH' > > / etc/profile [root@mysql tools] # tail-1 / etc/profileexport PATH=/usr/local/mysql/bin:$PATH [root@mysql tools] # source / etc/profile [root@mysql tools] # echo $PATH/usr/local/mysql/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin [root@mysql tools] #

8. Copy, view, set owner, and add tmp permissions

[root@mysql tools] #\ cp mysql-5.5.16/support-files/my-small.cnf / etc/my.cnf [root@mysql tools] # ll / usr/local/mysql/data/total 0drwxr-xr-x 2 root root 20 May 31 11:51 test [root@mysql tools] # chown-R mysql.mysql / usr/local/mysql/data/ [root@mysql tools] # chmod-R 1777 / tmp/ [root@mysql tools] #

9. Initialize the database

[root@mysql tools] # cd / usr/local/mysql/scripts/ [root@mysql scripts] #. / mysql_install_db-basedir=/usr/local/mysql/-datadir=/usr/local/mysql/data/-user=mysqlInstalling MySQL system tables... OKFilling help tables... OK

Note: seeing two ok indicates success

10. Set boot up

[root@mysql scripts] # cd / roottools/mysql-5.5.16 [root@mysql mysql-5.5.16] # cp support-files/mysql.server / etc/init.d/mysqld [root@mysql mysql-5.5.16] # chmod-R 755 / etc/init.d/mysqld [root@mysql mysql-5.5.16] # chkconfig-add mysqld [root@mysql mysql-5.5.16] # chkconfig mysqld on [root@mysql mysql-5.5.16] # chkconfig List mysqldNote: This output shows SysV services only and does not include nativesystemd services. SysV configuration data might be overridden by nativesystemd configuration.If you want to list systemd services use'systemctl list-unit-files'.To see services enabled on particular target use'systemctl list-dependencies [target] '.mysqld 0:off 1:off 2:on 3:on 4:on 5:on 6:off [root@mysql mysql-5.5.16] #

11. Start the mysql database

[root@mysql mysql-5.5.16] # / etc/init.d/mysqld startStarting MySQL... SUCCESS! [root@mysql mysql-5.5.16] #

12. View the port process

[root@mysql mysql-5.5.16] # lsof-i:3306COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAMEmysqld 51146 mysql 10u IPv4 82600 0t0 TCP: mysql (LISTEN) [root@mysql mysql-5.5.16] # netstat-lnutp | grep 3306tcp 00 0.0.0.0 mysql 3306 0.0.0.0: LISTEN 51146/mysqld [root@mysql mysql-5.5.16] # ps-ef | grep 3306mysql 51146 50900 0 14:13 pts/1 00:00:00 / usr/local/mysql-5. 5.16/bin/mysqld-basedir=/usr/local/mysql-5.5.16-datadir=/usr/local/mysql-5.5.16/data-plugin-dir=/usr/local/mysql-5.5.16/lib/plugin-user=mysql-log-error=/usr/local/mysql-5.5.16/data/mysql.err-pid-file=/usr/local/mysql-5.5.16/data/mysql.pid-socket=/usr/local/mysql-5 .5.16 / tmp/mysql.sock-- port=3306root 51170 16240 0 14:14 pts/1 00:00:00 grep-- color=auto 3306 [root@mysql mysql-5.5.16] #

Note: if you want to reinitialize, simply delete the data directory library file store or create a new library file store, and reinitialize it, indicating that the two ok are successful.

Access to the database

[root@localhost ~] # mysql

View all users

Mysql > use mysqlmysql > show tables;mysql > select user,host from user

Delete the system default

Delete from mysql.user where user='';delete from mysql.user where host='::1';select user,host from mysql.user

Only these two are kept.

Mysql > select user,host from mysql.user; ±- + | user | host | ±- ±- + | root | 127.0.0.1 | | root | localhost | ±- ±- + 2 rows in set (0.00 sec) mysql > #

Add additional authorized administrator users

Grant all privileges on. To system@'192.168.%' identified by 'system' with grant option

Character set path

Vi / etc/locale.conf # centos7

Mysql create password

/ application/mysql//bin/mysqladmin-u root password '123456'

Mysql change password

/ application/mysql//bin/mysqladmin-u root-p123456 password '112233' after reading this article, I believe you have some understanding of the method of installing mysql using cmake on linux. Want to know more about it. Welcome to follow the industry information channel. Thank you for reading!

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