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

MySQL source code compilation and installation

2025-04-12 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

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

1. Install cmake-2.8.10.2.tar.gz

Enter shell as root user

# tar-zxvf cmake-2.8.10.2.tar.gz

# cd cmake-2.8.10.2

#. / configure

# make (cannot make, detect gcc compilation environment)

# make install

-

2. Install ncurses-5.9.tar.gz

# tar-zxvf ncurses-5.9.tar.gz

# cd ncurses-5.9

# mkdir / usr/local/ncurses-5.9/

#. / configure-prefix=/usr/local/ncurses-5.9/

# make

# make install

-

3. Install mysql-5.5.28.tar.gz

# tar-zxvf mysql-5.5.28.tar.gz

# cd mysql-5.5.28

# mkdir-p / usr/local/mysql (create database installation directory)

# mkdir-p / usr/local/mysql/data (storing database)

# groupadd mysql

# useradd-r-g mysql mysql

Start compiling mysql source code

# cmake. -DCMAKE_INSTALL_PREFIX=/usr/local/mysql/-DMYSQL_DATADIR=/usr/local/mysql/data-DCURSES_INCLUDE_PATH=/usr/local/ncurses-5.9/include/-DCURSES_LIBRARY=/usr/local/ncurses-5.9/lib/libncurses.a

# make

# make install (mysql will be installed after this one is finished)

4. Configure MySQL

Set directory permissions

# cd / usr/local/mysql

# chown-R root:mysql. (set the owner owner of all files in the current directory to root and the group to which they belong to mysql)

# chown-R mysql:mysql data

# cp support-files/my-medium.cnf / etc/my.cnf (add mysql startup service to system service)

Create a table for the system database

# cd / usr/local/mysql

# scripts/mysql_install_db-user=mysql

Start mysql manually

# cd / usr/local/mysql

#. / bin/mysqld_safe-user=mysql &

# mysqladmin-u root-p shutdown (stop the MySQL service, where the root user of MySQL has not yet configured a password, so it is null. When you need to enter a password, just click the enter key.)

Another simple way to start mysql (mysql has been added to the system service)

# cp support-files/mysql.server / etc/init.d/mysql (add mysql startup service to system service)

# service mysql.server start starts mysql service

# service mysql.server stop shuts down mysql service

# service mysql.server restart restart mysql service

Add mysql to the environment variable so that you can enter mysql by typing mysql in the shell environment.

# vi / etc/profile

Join at the end

Export MYSQL_HOME=/usr/local/mysql

Export PATH=$MYSQL_HOME/bin:$PATH

# wq save

# source / etc/profile refresh configuration file

After typing in mysql, you can see the mysql console interface.

Change the password of the root user of MySQL and open a remote connection

# mysql-u root mysql

Mysql > use mysql

Mysql > desc user

Mysql > GRANT ALL PRIVILEGES ON *. * TO root@ "%" IDENTIFIED BY "root"; (the ability to add remote connections to root.)

Mysql > update user set Password = password ('root') where User='root'; (set root user password to root, customizable)

Mysql > select Host,User,Password from user where User='root'

Mysql > flush privileges

Mysql > exit

Log in again: mysql-u root-proot

If a remote connection cannot be made, turn off the firewall

# / etc/rc.d/init.d/iptables stop

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