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 and configure Mysql for Linux in binary mode

2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

This article introduces the relevant knowledge of "how to install and configure Mysql for Linux in a binary way". Many people will encounter this dilemma in the operation of actual cases, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

1. Preparation and installation

1) View the OS version

# cat / etc/redhat-release

2) create mysql groups and users

# groupadd mysql

# cat / etc/group | grep mysql

# useradd-r-g mysql mysql

# cat / etc/passwd | grep mysql

3) download the mysql binary installation package and upload it to the / usr/local directory

# cd / usr/local

# ll

4) decompress the binary package

# tar xvfz mysql-5.7.18-linux-glibc2.5-x86_64.tar.gz

# mv mysql-5.7.18-linux-glibc2.5-x86_64 mysql

# ll

5) change the groups and users described in the mysql directory

# chown-R mysql.mysql mysql/

# ll

6) check the contents of the support-files folder to find the my_default.cnf configuration file. If it does not exist, you can manually create and configure the configuration file, and place the created parameter in the support-files folder, as follows:

[mysqld]

Character-set-server=utf8

Basedir = / usr/local/mysql/

Datadir=/usr/local/mysql/data/

Log-error=/usr/local/mysql/mysqld.log

Port = 3306

Socket=/tmp/mysql.sock

Skip-grant-tables = 1

Note:

In the above configuration file, parameter skip-grant-tables=1, set the mysql system to skip password login, either do not use a password to log in to the mysql database, you can modify root permissions after login, and then turn off the parameter.

7) Register and initialize the mysql service

# bin/mysqld-initialize-insecure-user=mysql-basedir=/usr/local/mysqld/-datadir=/usr/local/mysql/data/

8) copy the created my_default.cnf and mysql.server to the / etc and / etc/init.d/ directories

# cp / usr/local/mysql/support-files/my_default.cnf / etc/my.cnf

# cp / usr/loca/mysql/support-files/mysql.server / etc/init.d/mysqld

9) start mysql

# cd bin

#. / mysqld_safe-user=mysql

Or

# / etc/init.d/mysqld start

two。 Configuration and management

1) Connect to mysql

# cat / root/.mysql_secret

#. / mysql-uroot-p

2) modify root password and remote login permissions

Mysql > set password=password ('root')

Mysql > flush privilleges

Mysql > use mysql

Mysql > update user set host='%' where user='root'

3) restart the mysql service and try the remote connection

# / etc/init.d/mysqld restart

$mysql-uroot-proot-h 10.10.10.1

4) set it to start automatically.

# chkconfig-add mysqld

# service mysqld status

# chkconfig-- level 2345 mysqld on

# chkconfig-list

This is the end of the content of "how to install and configure Mysql for Linux in binary mode". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

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

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report