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 server

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

Share

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

This article mainly explains "how to install mysql on Linux server". Interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn how to install mysql on Linux server.

Install mysql

1. Check whether mysql is installed

[root@localhost bin] # rpm-qa | grep mysql

Mysql-libs-5.1.71-1.el6.i686

[root@localhost bin]

2. Install mysql and mysql-server

[root@localhost bin] # yum install-y mysql

[root@localhost bin] # yum install-y mysql-server

3. Start mysql and notice that the name of the service here is "mysqld"

[root@localhost bin] # service mysqld start

Shell-init: error retrieving current directory: getcwd: cannot access parent directories: there is no such file or directory

Chdir: error retrieving current directory: getcwd: cannot access parent directories: there is no such file or directory

Initialize the MySQL database: Installing MySQL system tables...

OK

Filling help tables...

OK [OK]

Starting mysqld: [OK]

[root@localhost bin] #

4. Configure MySQL to boot

[root@localhost bin] # chkconfig mysqld on

[root@localhost bin] # chkconfig-- list mysqld

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

[root@localhost bin] #

5. Set the root user password. The command to set the password is "mysqladmin-u username password password".

[root@localhost bin] # mysqladmin-u root password 543092 / / password is 543092

6. Change the password. The command is "mysqladmin-u user name-p password new password".

[root@localhost bin] # mysqladmin-u root-p password 123456 / / New password 123456

Enter password: / / the old password is required here

[root@localhost bin] #

7. Mysql configuration file "/ etc/my.cnf"

[root@localhost bin] # cat / etc/my.cnf

[mysqld]

Datadir=/var/lib/mysql / / database file directory

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

User=mysql

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

Symbolic-links=0

[mysqld_safe]

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

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

8. Modify the port

1) the default port of mysql is 3306, which can be viewed using netstat

[root@localhost bin] # netstat-tunlp | grep mysqld

Tcp 0 0 0.0.0.0 3306 0.0.0.015 * LISTEN 4339/mysqld

2) modify the port in the configuration file, open the configuration file, and append the word "port=xxx" after it.

[root@localhost bin] # gedit / etc/my.cnf

Port=3307

3) restart the myslqd service to view the port

[root@localhost bin] # service mysqld restart

Shell-init: error retrieving current directory: getcwd: cannot access parent directories: there is no such file or directory

Chdir: error retrieving current directory: getcwd: cannot access parent directories: there is no such file or directory

^ [A stop mysqld: [OK]

Starting mysqld: [OK]

[root@localhost bin] # netstat-tunlp | grep mysqld

Tcp 0 0 0.0.0.0 3307 0.0.0.015 * LISTEN 4604/mysqld

At this point, I believe you have a deeper understanding of "Linux server how to install mysql", might as well come to the actual operation of it! Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

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

Servers

Wechat

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

12
Report