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

Winning bid for Kirin operating system to install mysql5.7.21

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

Share

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

Download the installation package on the official website.

1. Check whether the mysql package has been installed:

Rpm-qa | grep mysql

Mysql-libs-5.1.73-8.el6_8.ns6.01.x86_64

Mysql-5.1.73-8.el6_8.ns6.01.x86_64

Mysql-devel-5.1.73-8.el6_8.ns6.01.x86_64

2. Uninstall:

Rpm-e-- nodeps mysql-libs-5.1.73-8.el6_8.ns6.01.x86_64

Rpm-e-- nodeps mysql-5.1.73-8.el6_8.ns6.01.x86_64

Rpm-e-- nodeps mysql-devel-5.1.73-8.el6_8.ns6.01.x86_64

3. Find the installation path of mysql and delete it one by one.

Find / name mysql

After that, the installation begins.

Mkdir / home/mysql

Mkdir / home/mysql/data

Groupadd mysql

Useradd-g mysql-d / home/mysql mysql

Extract the installation package

Tar-xzvf mysql-5.7.21-linux-glibc2.12-x86_64.tar.gz

Cd mysql-5.7.21-linux-glibc2.12-x86_64

Move the directory to the home/mysql directory and rename

Mv * / home/mysql

Cd / home/mysql

Ls

Install, print the last act on the screen and copy down the initial password for later use.

. / bin/mysqld-user=mysql-basedir=/home/mysql-datadir=/home/mysql/data-initialize

Bin/mysql_ssl_rsa_setup-datadir=/home/mysql/data

Modify data directory permissions in mysql directory

Chown-R mysql:mysql / home/mysql/data

Chmod-R 755 / home/mysql/data

Cd support-files/

Ls

Vim mysql.server

Basedir=/home/mysql

Datadir=/home/mysql/data

: wq

. / support-files/mysql.server start

If there is no my.cnf under / etc/, create one yourself.

Touch / etc/my.cnf

Vim / etc/my.cnf

[client]

Port = 3306

Default-character-set=utf8

[mysqld]

Basedir = / home/mysql

Datadir = / home/mysql/data

Port = 3306

Character_set_server=utf8

Init_connect='SET NAMES utf8'

: wq

(not all configuration files can be copied elsewhere)

Put the startup script in the boot initialization directory

Cp / home/mysql/support-files/mysql.server / etc/init.d/mysqld

Chmod 755 / etc/init.d/mysql

Chmod 755 / etc/init.d/mysqld

Chkconfig-- add mysqld registers mysql as a startup entry

Chkconfig-- list mysqld to check whether the addition is successful

Chkconfig mysqld on

Create a soft connection

Ln-s / home/mysql/bin/mysql / usr/bin/mysql

Cd bin

. / mysql-u root-p

Initial password generated by the system

Set password=password ('new password')

Use mysql

Update user set host='%' where user='root'

GRANT ALL PRIVILEGES ON. Password set by TO 'username' @'% 'IDENTIFIED BY' 'WITH GRANT OPTION

FLUSH PRIVILEGES

Exit

Service mysqld restart

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