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 mysql on Linux platform

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

Share

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

The following content mainly brings you Linux platform installation mysql explanation, the knowledge here is slightly different from books, are professional and technical personnel in the process of contact with users, summed up, has a certain experience sharing value, hope to bring help to the majority of readers.

I. Environmental preparation

OS:RHEL6.4

Media: mysql-5.6.36.tar.gz

Cmake-2.8.4.tar.gz

II. Installation process

Dependent package installation

# yum install-y make bison gcc gcc-c++ ncurses ncurses-devel

Cmake installation

# tar-zxvf cmake-2.8.4.tar.gz

# cd cmake

#. / configure

# make & & make install

Prepare mysql user

# groupadd mysql

# useradd mysql-g mysql

# add a user named mysql.

-g: specify the user group to which the new user belongs (group)

Install mysql

# tar zxvf mysql-5.6.36.tar.gz

# cd mysql-5.6.36

# cmake.-DCMAKE_INSTALL_PREFIX=/usr/local/mysql\

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

-SYSCONFDIR=/etc\

-DWITH_MYISAM_STORAGE_ENGINE=1\

-DWITH_INNOBASE_STORAGE_ENGINE=1\

-DWITH_MEMORY_STORAGE_ENGINE=1\

-DWITH_READLINE=1\

-DMYSQL_UNIX_ADDR=/tmp/mysqld.sock\

-DMYSQL_TCP_PORT=3306\

-DENABLED_LOCAL_INFILE=1\

-DWITH_PARTITION_STORAGE_ENGINE=1\

-DEXTRA_CHARSET=all\

-DDEFAULT_CHARSET=utf8\

-DDEFAULT_COLLATION=utf8_general_ci

# make

# make install

Modify permissions

# chown-R mysql:mysql / usr/local/mysql (change the user and group of all files under the mysql installation directory to mysql)

# chmod Ubunw / usr/local/mysql (let user have write access to the mysql installation directory)

Build mysql database storage directory

# mkdir-p / mysqldata

Change user and group to mysql

# chown mysql:mysql / mysqldata-R

Initialize the mysql permissions table

# cd / usr/local/mysql (install directory for mysql)

Run the script that initializes the mysql permissions table:

# scripts/mysql_install_db-user=mysql--basedir=/usr/local/mysql--datadir=/mysqldata

Copy the configuration file of mysql to / etc

# cp support-files/my-default.cnf/etc/my.cnf

Modify MySQL configuration file my.cnf

# vi / etc/my.cnf

[client]

Port=3306

Socket=/tmp/mysqld.sock

Default-character-set=utf8

[mysqld]

Sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES

Port=3306

Basedir=/usr/local/mysql

Datadir=/mysqldata

Socket=/tmp/mysqld.sock

User=mysql

Default-time-zone=system

Character-set-server=utf8

Default-storage-engine=InnoDB

Log-error=/mysqldata/mysqld.log

Pid-file=/var/run/mysqld/mysqld.pid

Description:

Mkdir / var/run/mysqld

Chown mysql:mysql / var/run/mysqld

Create a log directory at the same time

Mkdir / mysqldata/log

Chown mysql:mysql / data0/mysql/3306/log

Start mysql: (to / usr/local/mysql/bin directory)

#. / mysqld_safe-defaults-file=/etc/my.cnf&

See if it succeeds.

# ps-ef | grep mysqld

Or

# netstat-tunpl | grep mysqld

Or use the following command to add mysql as a system service.

Cd / usr/local/mysql/support-files/

Cp. / mysql.server / etc/init.d/mysqld

/ etc/init.d/mysqld start

Change the root default password

Just installed root default password is empty, for security needs to set a password.

# cd / usr/local/mysql/bin

#. / mysqladmin-u root password (enter to set a new password in the next prompt)

Shut down the mysqld CVM

#. / bin/mysqladmin-u root-p shutdown

Client connects to server

#. / mysql-uroot-p

For the above explanation on the installation of mysql on the Linux platform, if you have more information, you can continue to pay attention to the innovation of our industry. If you need professional answers, you can contact the pre-sale and after-sale ones on the official website. I hope this article can bring you some knowledge updates.

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