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 install the mysql source package

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

Share

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

Following the author to learn how to install the mysql source package, I believe you will benefit a lot after reading, the text is not much in the essence, hope that how to install the mysql source package this short content is what you want.

Preparation work before mysql installation

Environment preparation: linux system cmake mysql installation package

Uninstall the mysql installed by the rpm package

Yum-y remove mysql mysql-server

Rm-rf / etc/my.cnf

Install to resolve dependencies: yum-y install ncurses-devel openssl-devel bison gcc gcc-c++

Mysql source package installation

Upload the source code package to / usr/local/src

Tar xzf mysql installation package

Yum-y install cmake

Yum-y install bison

Groupadd mysql

Useradd-g mysql mysql

Cd / lamp/mysql-5.5.23

Cmake\

-DCMAKE_INSTALL_PREFIX=/usr/local/mysql\

-DMYSQL_UNIX_ADDR=/tmp/mysql.sock-DEXTRA_CHARSETS=all\

-DDEFULT_CHARSET=utf8-DDEFAULT_COLLATION=utf8_general_ci\

-DWITH_MYISAM_STORAGE_ENGINE=1-DWITH_INNOBASE_STORAGE_ENGINE=1\

-DWITH_MEMORY_STORAGE_ENGINE=1-DWITH_READLINE=1-DENABLED_LOCAL_INFILE=1\

-DMYSQL_USER=mysql-DMYSQL_TCP_PORT=3306\

-DMYSQL_DATADIR=/usr/local/mysql/data\

-DSYSCONFDIR=/etc\

Cmake-DCMAKE_INSTALL_PREFIX=/usr/local/mysql / / installation location

-DMYSQL_UNIX_ADDR=/tmp/mysql.sock / / specify the socket (socket) file location

-DEXTRA_CHARSETS=all / / extended character support

-DDEFULT_CHARSET=utf8 / / default character set

-DDEFAULT_COLLATION=utf8_general_ci / / default character proofreading

-DWITH_MYISAM_STORAGE_ENGINE=1 / / install the myisam storage engine

-DWITH_INNOBASE_STORAGE_ENGINE=1 / / install the innodb storage engine

-DWITH_MEMORY_STORAGE_ENGINE=1 / / install the memory storage engine

-DWITH_READLINE=1 / / supports readline libraries

-DENABLED_LOCAL_INFILE=1 / / enable loading of local database

-DMYSQL_USER=mysql / / specify mysql running user

-DMYSQL_TCP_PORT=3306 / / specify mysql port

-DMYSQL_DATADIR=/usr/local/mysql/data / / database directory, which is very important if this is not a normal directory but a storage mount point in the enterprise.

-DSYSCONFDIR=/etc / / configuration file directory

Make & & make install

Script is used in the actual production environment, because the manual efficiency is low, easy to make mistakes, the configuration options here are commonly used, in the actual production environment to consider tuning, performance, arrangement to do other corresponding options.

Mysql initialization process, first use

Cd / usr/local/mysql

Chown mysql:mysql-R / usr/local/mysql / / sets the owner to mysql

. / scripts/mysql_install_db-- user=mysql-- datadir=/usr/loacl/mysql/data / / create database authorization table, initialize database, initialization failure is usually due to lack of specified character set, hostname resolution, etc.

Cp support-files/my-huge.cnf / etc/my.cnf / / large database template to initialize its main configuration file

Cp support-files/mysql.server / etc/init.d/mysqld / / the scarlet letter of the copy boot service script is the directory location after the source code is unzipped.

Chmod aquix / etc/init.d/mysqld / / Grant the right to execute the boot script

Chkconfig-- add mysqld / / added to boot self-startup

Chkconfig-list mysqld

Chkconfig mysqld on

Service mysqld on

Service mysqld start

If you look at the error log in the general case of startup failure, it will tell you the reason, usually because the hostname can be resolved, the character set is not specified, and so on.

Netstat-an | grep mysql / / check whether the database is started, which contains configuration file, error log location, installation information, port number, character set and other process information

Vim / etc/profile / / Edit this configuration file so that everyone can directly use the mysql command in the future without adding the full path.

/ / add mysql road strength to the environment variable, and the red font is the addition

Source / etc/profile / / make the configuration file effective

Echo "export PATH=$PATH:/usr/local/mysql/bin" > > / etc/profile / added to the system environment variable is easy to search. If it is a rpm package, it will be automatically placed in the path variable.

Source / etc/porfile

Login Test:

Mysqladmin-uroot password 'mysql123' / / set the mysql password

Mysql-u root-p mysql123 login test:

Ctrl+l screen cleaning

After reading this article, many readers will want to know more about it. If you need more industry information, you can follow our industry information section.

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