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

Install the Mysql database

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

Share

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

1. Install the Mysql database

① downloads Mysql packets

Wget http://mirrors.sohu.com/mysql/MySQL-5.6/mysql-5.6.35-linux-glibc2.5-x86_64.tar.gz

② unzips the package under / usr/local/src

Tar zxvf mysql-5.6.35-linux-glibc2.5-x86_64.tar.gz

③ renamed the extracted package to mysql

Mv mysql-5.6.35-linux-glibc2.5-x86_64 / usr/local/mysql

④ creates a user named mysql and the / data/ folder is used to store data from the mysql database

Useradd mysql mkdir / data/

⑤ runs the script to install the database

[root@test_01 mysql] # / scripts/mysql_install_db-- user=mysql-- datadir=/data/mysqlFATAL ERROR: please install the following Perl modules before executing. / scripts/mysql_install_db:Data::Dumper

An error occurs here, indicating that you need to install Dumper first, and then fix the problem after installing perl-Data-Dumper.

[root@test_01 mysql] # yum install-y perl-Data-Dumper

⑥ copies the mysql template configuration file to / etc/my.cnf. And modify the values of socket and datadir to the following

Datadir=/data/mysqlsocket=/tmp/mysql.sock

⑦ configuration Startup File

Copy the mysql.server file to / etc/init.d/mysqld and configure basedir and datadir

[root@test_01 mysql] # cp support-files/mysql.server / etc/init.d/mysqldbasedir=/usr/local/mysqldatadir=/data/mysql

Add mysqld to the startup service

[root@test_01 mysql] # chkconfig-- add mysqld [root @ test_01 mysql] # chkconfig-- Note: this output only shows SysV services, not native systemd services. SysV configuration data may be overwritten by native systemd configurations. If you want to list systemd services, execute 'systemctl list-unit-files'. To view the services enabled for a particular target, execute 'systemctl list-dependencies [target]'. Mysqld 0: off 1: off 2: on 3: on 4: on 5: on 6: off netconsole 0: off 1: off 2: on 3: off 4: off 5: off 6: off network 0: off 1: on 3: on 4: on 6: disable xinetd-based services: Chargen-dgram: off chargen-stream: off daytime-dgram: off daytime-stream: off discard-dgram: off discard-stream: off echo-dgram: off echo-stream: off tcpmux-server: off time-dgram: off time-stream: off

⑧ Startup Service

[root@test_01 mysql] # service mysqld startStarting MySQL.Logging to'/ data/mysql/test_01.err'. SUCCESS! [root@test_01 mysql] # netstat-lntpActive Internet connections (only servers) Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program nametcp 0 0 0.0.0.0 only servers 22 0.0.0.0 only servers * LISTEN 1411/sshdtcp 0 0 127.0.1 15 0.0.0.0 : * LISTEN 2075/mastertcp 0 0 192.168.231.128 LISTEN 9562/mysqldtcp6 873 0.0.0.0 LISTEN 5995/rsynctcp6 0 0: 3306:: * LISTEN 9562/mysqldtcp6 0 0: 22:: * LISTEN 1411/sshdtcp6 0 0:: 1:25: * LISTEN 2075/master

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