search
HomeDatabaseMysql TutorialLet's talk about the cmake method of mysql

This article will give you a brief analysis of the cmake method of installing mysql, and introduce some knowledge of the cmake method. I hope it will be helpful to everyone!

is generally divided into the following types

yum
rpm package
Conventional compilation and installation
cmake installation
Binary package installation free

How to choose

Personal useYum or rpm package installation

Enterprise useUse regular compilation Free installation with cmake and binary packages

If the quantity is small
For the 5.1.x version, choose to use regular compilation and installation
For the 5.5.x version, choose to use cmake to compile and install

If the quantity is large
Use the binary package directly without installation

First check the system environment

[root@localhost ~]# cat /etc/redhat-release 
CentOS release 6.5 (Final)
[root@localhost ~]# uname -r
2.6.32-431.el6.x86_64
[root@localhost ~]# uname -m
x86_64

When installing cmake software, you need to install gcc and gcc-c

yum -y install gcc

yum -y install gcc-c

After compiling and installing cmake, you need to install dependency packages

yum install ncurses-devel -y

Remember first To install users and groups
[root@localhost ~]# groupadd mysql
[root@localhost ~]# useradd mysql -s /sbin/nologin -M -g mysql

Dependent packages are installed After that, cd into the mysql directory for cmake operation

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=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 \
-DWITH_FAST_MUTEXES=1 \
-DWITH_ZLIB=bundled \
-DENABLED_LOCAL_INFILE=1 \
-DWITH_READLINE=1 \
-DWITH_EMBEDDED_SERVER=1 \
-DWITH_DEBUG=0 \


-DWITHOUT_PARTITION_STORAGE_ENGINE=1 \           貌似因为64位主机编译不过去!!!
-DWITH_MYISAM_STORAGE_ENGINE=1 \
-DWITH_ARCHIVE_STORAGE_ENGINE=1 \
-DENABLED_LOCAL_INFILE=1 \
-DEXTRA_CHARSETS=all "
执行成功返回下面代码

Build files have been written to: /root/lamp/mysql-5.5.32

make && install
安装完成

[100%] Built target my_safe_process #This Make completion
....
....
....
-- Installing: /application/mysql-5.5.32/support-files/solaris/postinstall-solaris # Here make install is completed

建立link

ln -s /application/mysql-5.5.32/ application/mysql

建立my.cnf

[root@localhost /]# cp /application/mysql-5.5.32 /support-files/my-small.cnf /etc/my.cnf
cp: Overwrite "/etc/my.cnf"? y

配置环境变量

echo 'export PATH=/application/mysql/bin:$PATH' >> /etc/profile
tail -l /etc/profile
source /etc/profile
echo $PATH

给mysql用户和mysql用户组授权

chown -R mysql.mysql /application/mysql/data/

chmod -R 1777 /tmp/

初始化db脚本,假如有两个ok,就证明成功

[root@localhost / ]# cd /application/mysql/scripts/
[root@localhost scripts]# ./mysql_install_db --basedir=/application/mysql/ --datadir=/application/mysql/data/ --user=mysql
Installing MySQL system tables...
OK
Filling help tables...
OK

修改hosts文件

vim /etc/hosts

Join www

加入mysqld脚本

cp /root/lamp/mysql-5.5.32/support-files/mysql.server /etc/init.d/mysqld

加入mysqld脚本执行权限

chmod x /etc/init.d/mysqld

执行mysqld运行

[root@localhost scripts]# /etc/init.d/mysqld start
Starting MySQL...                                                                                                                                                                                                                                                        0 0 0.0.0.0:3306 0.0.0.0:* 2671/mysqld

进入mysql服务器,如果之前配置了环境变量了,就可以执行mysql命令

mysql
删除空用户

##mysql> select user ,host from mysql.user ;userhost -- ---- ----------------------- root127.0.0.1root::1# #localhostlocalhost##localhost.localdomainrootlocalhost.localdomainmysql> delete from mysql.user where user ='';Query OK, 2 rows affected (0.09 sec)



root

6 rows in set (0.00 sec)

##mysql> select user,host from mysql.user;

hostroot##rootlocalhostrootlocalhost.localdomain##4 rows in set (0.00 sec)mysql> ;mysql> grant all privileges on . to system@'localhost' identified by 'longjq' with grant option;

user
---- -----------------------

127.0.0.1
root ::1
授权system管理员
Query OK, 0 rows affected (0.00 sec)

修改mysql密码
/application/mysql//bin/mysqladmin -u root password '123456'

/application/mysql//bin/mysqladmin -u root -h localhost.localdomain password 'new-password'

Rrieee

[root@localhost scripts]#chKConfig -List mysqld mysqld 0: Close 1: Close 2: Enlightenment 3: Enlightenment 5: Enlighten 6: Close

##Troubleshooting


Can’t log in to mysql? Delete the file and re-initialize

加入启动管理

Character set error?

# mysql
access denied for user 'localhost'......
# pkill mysqld
# lsof -i :3306
# rm -fr /application/mysql/data/*
# /application/mysql/scripts/mysql_install_db --basedir=/application/mysql/ --datadir=/application/mysql/data/ --user=mysql
Recommended learning: "mysql video tutorial

"

The above is the detailed content of Let's talk about the cmake method of mysql. For more information, please follow other related articles on the PHP Chinese website!

Statement
This article is reproduced at:segmentfault. If there is any infringement, please contact admin@php.cn delete
What Are the Limitations of Using Views in MySQL?What Are the Limitations of Using Views in MySQL?May 14, 2025 am 12:10 AM

MySQLviewshavelimitations:1)Theydon'tsupportallSQLoperations,restrictingdatamanipulationthroughviewswithjoinsorsubqueries.2)Theycanimpactperformance,especiallywithcomplexqueriesorlargedatasets.3)Viewsdon'tstoredata,potentiallyleadingtooutdatedinforma

Securing Your MySQL Database: Adding Users and Granting PrivilegesSecuring Your MySQL Database: Adding Users and Granting PrivilegesMay 14, 2025 am 12:09 AM

ProperusermanagementinMySQLiscrucialforenhancingsecurityandensuringefficientdatabaseoperation.1)UseCREATEUSERtoaddusers,specifyingconnectionsourcewith@'localhost'or@'%'.2)GrantspecificprivilegeswithGRANT,usingleastprivilegeprincipletominimizerisks.3)

What Factors Influence the Number of Triggers I Can Use in MySQL?What Factors Influence the Number of Triggers I Can Use in MySQL?May 14, 2025 am 12:08 AM

MySQLdoesn'timposeahardlimitontriggers,butpracticalfactorsdeterminetheireffectiveuse:1)Serverconfigurationimpactstriggermanagement;2)Complextriggersincreasesystemload;3)Largertablesslowtriggerperformance;4)Highconcurrencycancausetriggercontention;5)M

MySQL: Is it safe to store BLOB?MySQL: Is it safe to store BLOB?May 14, 2025 am 12:07 AM

Yes,it'ssafetostoreBLOBdatainMySQL,butconsiderthesefactors:1)StorageSpace:BLOBscanconsumesignificantspace,potentiallyincreasingcostsandslowingperformance.2)Performance:LargerrowsizesduetoBLOBsmayslowdownqueries.3)BackupandRecovery:Theseprocessescanbe

MySQL: Adding a user through a PHP web interfaceMySQL: Adding a user through a PHP web interfaceMay 14, 2025 am 12:04 AM

Adding MySQL users through the PHP web interface can use MySQLi extensions. The steps are as follows: 1. Connect to the MySQL database and use the MySQLi extension. 2. Create a user, use the CREATEUSER statement, and use the PASSWORD() function to encrypt the password. 3. Prevent SQL injection and use the mysqli_real_escape_string() function to process user input. 4. Assign permissions to new users and use the GRANT statement.

MySQL: BLOB and other no-sql storage, what are the differences?MySQL: BLOB and other no-sql storage, what are the differences?May 13, 2025 am 12:14 AM

MySQL'sBLOBissuitableforstoringbinarydatawithinarelationaldatabase,whileNoSQLoptionslikeMongoDB,Redis,andCassandraofferflexible,scalablesolutionsforunstructureddata.BLOBissimplerbutcanslowdownperformancewithlargedata;NoSQLprovidesbetterscalabilityand

MySQL Add User: Syntax, Options, and Security Best PracticesMySQL Add User: Syntax, Options, and Security Best PracticesMay 13, 2025 am 12:12 AM

ToaddauserinMySQL,use:CREATEUSER'username'@'host'IDENTIFIEDBY'password';Here'showtodoitsecurely:1)Choosethehostcarefullytocontrolaccess.2)SetresourcelimitswithoptionslikeMAX_QUERIES_PER_HOUR.3)Usestrong,uniquepasswords.4)EnforceSSL/TLSconnectionswith

MySQL: How to avoid String Data Types common mistakes?MySQL: How to avoid String Data Types common mistakes?May 13, 2025 am 12:09 AM

ToavoidcommonmistakeswithstringdatatypesinMySQL,understandstringtypenuances,choosetherighttype,andmanageencodingandcollationsettingseffectively.1)UseCHARforfixed-lengthstrings,VARCHARforvariable-length,andTEXT/BLOBforlargerdata.2)Setcorrectcharacters

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

mPDF

mPDF

mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

WebStorm Mac version

WebStorm Mac version

Useful JavaScript development tools

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver Mac version

Dreamweaver Mac version

Visual web development tools