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 installation and initial configuration

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

Share

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

The first version of the Mysql database was released on the Linux system

View the mysql installation package:

] # rpm-qa | grep mysql

Mysql-libs-5.1.73-8.el6_8.x86_64

Mysql-5.1.73-8.el6_8.x86_64

View the mysql packages available for yum:

] # yum list | grep mysql

Installation:

] # yum install-y mysql-server mysql mysql-deve

Uninstall:

] # rpm-e mysql

-- the nodesp option forces deletion

View the installed mysql:

] # rpm-qi mysql

Start the mysql service:

] # service mysqld start

When we use the mysql database, we have to start the mysqld service first. We can check whether the mysql service starts automatically with the command chkconfig-- list | grep mysqld:

] # chkconfig-- list | grep mysqld

Mysqld 0: close 1: close 2: close 3: close 4: close 5: close 6: close

Use the chkconfig mysqld on command to set it to boot:

# chkconfig mysqld on

Set the password for the mysql default root:

] # / usr/bin/mysqladmin-u root password 'testpwd'

Log in to mysql:

# mysql-uroot-paired testpwd'

View the database:

Mysql > show databases

+-+

| | Database |

+-+

| | information_schema |

| | mysql |

| | test |

+-+

3 rows in set (0.00 sec)

Mysql main configuration file:

] # cat / etc/my.cnf

[mysqld]

Datadir=/var/lib/mysql

Socket=/var/lib/mysql/mysql.sock

User=mysql

# Disabling symbolic-links is recommended to prevent assorted security risks

Symbolic-links=0

[mysqld_safe]

Log-error=/var/log/mysqld.log

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

Mysql database file:

# ls / var/lib/mysql/

Ibdata1 ib_logfile0 ib_logfile1 mysql mysql.sock test

Create your own database to verify the location of the database file:

Mysql > create database simonwang

Query OK, 1 row affected (0.00 sec)

] # ls-l / var/lib/mysql/

The total dosage is 20492

-rw-rw---- 1 mysql mysql 10485760 July 25 22:19 ibdata1

-rw-rw---- 1 mysql mysql 5242880 July 25 22:19 ib_logfile0

-rw-rw---- 1 mysql mysql 5242880 July 25 22:19 ib_logfile1

Drwx- 2 mysql mysql 4096 July 25 22:19 mysql

Srwxrwxrwx 1 mysql mysql 0 July 25 22:19 mysql.sock

Drwx- 2 mysql mysql 4096 July 25 22:32 simonwang

Drwx- 2 mysql mysql 4096 July 25 22:19 test

Mysql log output:

] # cat / var/log/mysqld.log

Mysql uses the tcpip protocol to see if it is listening on port 3306:

] # netstat-anp | grep 3306

Tcp 0 0 0.0.0.0 3306 0.0.0.015 * LISTEN 1402/mysqld

Or check to see if 3006 is listening:

] # ss-tnl | grep 3306

LISTEN 0 50 *: 3306 *: *

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