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 start and stop LinuxMySQL

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

Share

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

This article mainly introduces "how to start and stop LinuxMySQL". In daily operation, I believe many people have doubts about how to start and stop LinuxMySQL. The editor consulted all kinds of materials and sorted out simple and easy-to-use operation methods. I hope it will be helpful for you to answer the doubts about "how to start and stop LinuxMySQL"! Next, please follow the editor to study!

The platform built by the combination of inux operating system and MySQL database provides a guarantee for the development of applications. A good developer should consider the security and stability of the development platform when choosing the development environment. The following editor will explain how many important directories are there in LinuxMySQL? how to start and stop LinuxMySQL?

LinuxMySQL has several important directories

1. Database directory: / var/lib/mysql/.

2. Configuration file: / usr/share/mysql (mysql.server command and configuration file).

3. Related commands: / usr/bin (mysqladminmysqldump, etc.).

4. Startup script: / etc/rc.d/init.d/ (the directory where the article mysql is started).

LinuxMySQL changes login password

LinuxMySQL does not have a password by default, and the importance of adding a password after installation is self-evident.

1. Command

Usr/bin/mysqladmin-urootpassword'new-password'

Format: mysqladmin-u username-p old password password new password

2. Examples

Example 1: add a password 123456 to root.

Type the following command:

[chinastor.com-root@hostlocal] # / usr/bin/mysqladmin-urootpassword123456

Note: since root does not have a password at the beginning, the-p old password can be omitted.

3. Whether the modification is successful or not

1) Log in without password

[chinastor.com-root@hostlocal] # mysqlERROR1045:Accessdeniedforuser:'chinastor.com-root@localhost' (Usingpassword:NO)

An error is displayed indicating that the password has been changed.

2) Log in with the modified password

[chinastor.com-root@hostlocal] # mysql-uroot-pEnterpassword: (enter the modified password 123456) WelcometotheMySQLmonitor.Commandsendwith;or\ g.YourMySQLconnectionidis4ToserversionVl4.0.16Mustard TypeForhelp.Type'\ c'toclearthebuffer.mysql >

Success! This is to change the password through the mysqladmin command, or you can change the password by modifying the library.

How to start and stop LinuxMySQL

1. Start

After the MySQL installation is completed, the startup file mysql is in the / etc/init.d directory. Run the following command when you need to start.

[chinastor.com-root@hostinit.d] # / etc/init.d/mysqlstart

In addition, the installer installs MySQL as service, so you can start LinuxMySQL with # servicemysqlstart in any directory.

2. Stop

/ usr/bin/mysqladmin-uroot-pshutdown

Or:

# servicemysqlstop

3. Automatic start

1) check to see if mysql is in the auto startup list

[chinastor.com-root@hostlocal] # / sbin/chkconfig-list

2) add LinuxMySQL to the startup service group of your system

[chinastor.com-root@hostlocal] # / sbin/chkconfig-addmysql

3) remove LinuxMySQL from the startup service group.

[chinastor.com-root@hostlocal] # / sbin/chkconfig-delmysql

At this point, the study on "how to start and stop LinuxMySQL" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!

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