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
Explain the ACID properties (Atomicity, Consistency, Isolation, Durability).Explain the ACID properties (Atomicity, Consistency, Isolation, Durability).Apr 16, 2025 am 12:20 AM

ACID attributes include atomicity, consistency, isolation and durability, and are the cornerstone of database design. 1. Atomicity ensures that the transaction is either completely successful or completely failed. 2. Consistency ensures that the database remains consistent before and after a transaction. 3. Isolation ensures that transactions do not interfere with each other. 4. Persistence ensures that data is permanently saved after transaction submission.

MySQL: Database Management System vs. Programming LanguageMySQL: Database Management System vs. Programming LanguageApr 16, 2025 am 12:19 AM

MySQL is not only a database management system (DBMS) but also closely related to programming languages. 1) As a DBMS, MySQL is used to store, organize and retrieve data, and optimizing indexes can improve query performance. 2) Combining SQL with programming languages, embedded in Python, using ORM tools such as SQLAlchemy can simplify operations. 3) Performance optimization includes indexing, querying, caching, library and table division and transaction management.

MySQL: Managing Data with SQL CommandsMySQL: Managing Data with SQL CommandsApr 16, 2025 am 12:19 AM

MySQL uses SQL commands to manage data. 1. Basic commands include SELECT, INSERT, UPDATE and DELETE. 2. Advanced usage involves JOIN, subquery and aggregate functions. 3. Common errors include syntax, logic and performance issues. 4. Optimization tips include using indexes, avoiding SELECT* and using LIMIT.

MySQL's Purpose: Storing and Managing Data EffectivelyMySQL's Purpose: Storing and Managing Data EffectivelyApr 16, 2025 am 12:16 AM

MySQL is an efficient relational database management system suitable for storing and managing data. Its advantages include high-performance queries, flexible transaction processing and rich data types. In practical applications, MySQL is often used in e-commerce platforms, social networks and content management systems, but attention should be paid to performance optimization, data security and scalability.

SQL and MySQL: Understanding the RelationshipSQL and MySQL: Understanding the RelationshipApr 16, 2025 am 12:14 AM

The relationship between SQL and MySQL is the relationship between standard languages ​​and specific implementations. 1.SQL is a standard language used to manage and operate relational databases, allowing data addition, deletion, modification and query. 2.MySQL is a specific database management system that uses SQL as its operating language and provides efficient data storage and management.

Explain the role of InnoDB redo logs and undo logs.Explain the role of InnoDB redo logs and undo logs.Apr 15, 2025 am 12:16 AM

InnoDB uses redologs and undologs to ensure data consistency and reliability. 1.redologs record data page modification to ensure crash recovery and transaction persistence. 2.undologs records the original data value and supports transaction rollback and MVCC.

What are the key metrics to look for in an EXPLAIN output (type, key, rows, Extra)?What are the key metrics to look for in an EXPLAIN output (type, key, rows, Extra)?Apr 15, 2025 am 12:15 AM

Key metrics for EXPLAIN commands include type, key, rows, and Extra. 1) The type reflects the access type of the query. The higher the value, the higher the efficiency, such as const is better than ALL. 2) The key displays the index used, and NULL indicates no index. 3) rows estimates the number of scanned rows, affecting query performance. 4) Extra provides additional information, such as Usingfilesort prompts that it needs to be optimized.

What is the Using temporary status in EXPLAIN and how to avoid it?What is the Using temporary status in EXPLAIN and how to avoid it?Apr 15, 2025 am 12:14 AM

Usingtemporary indicates that the need to create temporary tables in MySQL queries, which are commonly found in ORDERBY using DISTINCT, GROUPBY, or non-indexed columns. You can avoid the occurrence of indexes and rewrite queries and improve query performance. Specifically, when Usingtemporary appears in EXPLAIN output, it means that MySQL needs to create temporary tables to handle queries. This usually occurs when: 1) deduplication or grouping when using DISTINCT or GROUPBY; 2) sort when ORDERBY contains non-index columns; 3) use complex subquery or join operations. Optimization methods include: 1) ORDERBY and GROUPB

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

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Chat Commands and How to Use Them
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌

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),

SAP NetWeaver Server Adapter for Eclipse

SAP NetWeaver Server Adapter for Eclipse

Integrate Eclipse with SAP NetWeaver application server.

WebStorm Mac version

WebStorm Mac version

Useful JavaScript development tools

MinGW - Minimalist GNU for Windows

MinGW - Minimalist GNU for Windows

This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

VSCode Windows 64-bit Download

VSCode Windows 64-bit Download

A free and powerful IDE editor launched by Microsoft