search
HomeDatabaseMysql TutorialHow to restart MySQL in linux

MySQL is the most popular relational database management system. In terms of WEB applications, MySQL is one of the best RDBMS application software. In this introduction, you will quickly master the method of restarting MySQL in Linux and use the MySQL database easily.

How to restart MySQL in linux

My.cnf has been modified and the MySQL service needs to be restarted. Please see the following article for the correct method of restarting MYSQL

Because it is installed from the source package Mysql, so there is no servcie mysqld restart script commonly used by Red Hat in the system

I have to restart it manually

Someone suggested Killall mysql. This barbaric method actually doesn't work. If the table is forced to terminate, the loss will be huge if the table is damaged.

The safe restart method is recommended here

$mysql_dir/bin/mysqladmin -u root -p shutdown
$mysql_dir/bin/safe_mysqld &

mysqladmin and mysqld_safe are located in the bin directory of the Mysql installation directory and are easy to find.

Restart the MySQL service under windows

For users who have not installed the mysql graphical management terminal to start and stop the mysql service:

    …\…\bin>net   stop mysql
    …\…\bin>net   start mysql

How to start/stop /Restart MySQL

Starting, stopping, and restarting MySQL are operations that every webmaster with an independent host must master. Here is a brief introduction to the operation method:

1. Startup method

1. Use service to start: service mysqld start

2. Use mysqld script to start: /etc/inint.d/mysqld start

3. Use safe_mysqld Start: safe_mysqld&

2. Stop

1. Use service to start: service mysqld stop

2. Use the mysqld script to start: /etc/inint.d/mysqld stop

3. mysqladmin shutdown

3. Restart

1. Use service to start: service mysqld restart

2. Use mysqld script to start: /etc/ inint.d/mysqld restart

It’s been a long time since I restarted mysql under Linux. It seems that the service is too stable. Haha, the machine died recently. After restarting, the mysql service has to be restarted. I forgot the command. I have no choice but to use Baidu or Google!

The following is what I searched from the Internet. It should be the most reliable one. Please try it and see if it works!

I haven’t messed with the server for a long time. I opened the page to be debugged early in the morning and found that the /tmp directory space was full, causing MySQL to be unable to run normally. So I modified the storage path of mysql.sock in my.cnf and related settings in php.ini. At this time, I need to restart MySQL. Haha, I haven’t messed with the server under Linux for a long time. I suddenly can’t remember how to do it. Here is the command to restart the MySQL service under the Linux operating system: (

So I searched Baidu and Google for "Command to restart MySQL under Linux". As soon as the search results were displayed, I found the answer from the summary information of the previous items: ) The following is the correct way to restart MySQL under Linux:

1. MySQL installed through rpm package

service mysqld restart

2. MySQL installed from the source package

// linux关闭MySQL的命令
$mysql_dir/bin/mysqladmin -uroot -p shutdown
// linux启动MySQL的命令
$mysql_dir/bin/mysqld_safe &

where mysql_dir is the MySQL installation directory, mysqladmin and mysqld_safe are located in the bin directory of the MySQL installation directory and are easy to find.

3. When the above methods are invalid, you can shut down MySQL by forcing the command: "killall mysql", but this method is not recommended because it This brutal method will forcibly terminate the MySQL database service and may cause table damage... so use it at your own discretion.

Related learning recommendations: mysql tutorial(video)

The above is the detailed content of How to restart MySQL in linux. For more information, please follow other related articles on the PHP Chinese website!

Statement
This article is reproduced at:CSDN. If there is any infringement, please contact admin@php.cn delete
What are the differences in syntax between MySQL and other SQL dialects?What are the differences in syntax between MySQL and other SQL dialects?Apr 27, 2025 am 12:26 AM

MySQLdiffersfromotherSQLdialectsinsyntaxforLIMIT,auto-increment,stringcomparison,subqueries,andperformanceanalysis.1)MySQLusesLIMIT,whileSQLServerusesTOPandOracleusesROWNUM.2)MySQL'sAUTO_INCREMENTcontrastswithPostgreSQL'sSERIALandOracle'ssequenceandt

What is MySQL partitioning?What is MySQL partitioning?Apr 27, 2025 am 12:23 AM

MySQL partitioning improves performance and simplifies maintenance. 1) Divide large tables into small pieces by specific criteria (such as date ranges), 2) physically divide data into independent files, 3) MySQL can focus on related partitions when querying, 4) Query optimizer can skip unrelated partitions, 5) Choosing the right partition strategy and maintaining it regularly is key.

How do you grant and revoke privileges in MySQL?How do you grant and revoke privileges in MySQL?Apr 27, 2025 am 12:21 AM

How to grant and revoke permissions in MySQL? 1. Use the GRANT statement to grant permissions, such as GRANTALLPRIVILEGESONdatabase_name.TO'username'@'host'; 2. Use the REVOKE statement to revoke permissions, such as REVOKEALLPRIVILEGESONdatabase_name.FROM'username'@'host' to ensure timely communication of permission changes.

Explain the differences between InnoDB and MyISAM storage engines.Explain the differences between InnoDB and MyISAM storage engines.Apr 27, 2025 am 12:20 AM

InnoDB is suitable for applications that require transaction support and high concurrency, while MyISAM is suitable for applications that require more reads and less writes. 1.InnoDB supports transaction and bank-level locks, suitable for e-commerce and banking systems. 2.MyISAM provides fast read and indexing, suitable for blogging and content management systems.

What are the different types of JOINs in MySQL?What are the different types of JOINs in MySQL?Apr 27, 2025 am 12:13 AM

There are four main JOIN types in MySQL: INNERJOIN, LEFTJOIN, RIGHTJOIN and FULLOUTERJOIN. 1.INNERJOIN returns all rows in the two tables that meet the JOIN conditions. 2.LEFTJOIN returns all rows in the left table, even if there are no matching rows in the right table. 3. RIGHTJOIN is contrary to LEFTJOIN and returns all rows in the right table. 4.FULLOUTERJOIN returns all rows in the two tables that meet or do not meet JOIN conditions.

What are the different storage engines available in MySQL?What are the different storage engines available in MySQL?Apr 26, 2025 am 12:27 AM

MySQLoffersvariousstorageengines,eachsuitedfordifferentusecases:1)InnoDBisidealforapplicationsneedingACIDcomplianceandhighconcurrency,supportingtransactionsandforeignkeys.2)MyISAMisbestforread-heavyworkloads,lackingtransactionsupport.3)Memoryengineis

What are some common security vulnerabilities in MySQL?What are some common security vulnerabilities in MySQL?Apr 26, 2025 am 12:27 AM

Common security vulnerabilities in MySQL include SQL injection, weak passwords, improper permission configuration, and unupdated software. 1. SQL injection can be prevented by using preprocessing statements. 2. Weak passwords can be avoided by forcibly using strong password strategies. 3. Improper permission configuration can be resolved through regular review and adjustment of user permissions. 4. Unupdated software can be patched by regularly checking and updating the MySQL version.

How can you identify slow queries in MySQL?How can you identify slow queries in MySQL?Apr 26, 2025 am 12:15 AM

Identifying slow queries in MySQL can be achieved by enabling slow query logs and setting thresholds. 1. Enable slow query logs and set thresholds. 2. View and analyze slow query log files, and use tools such as mysqldumpslow or pt-query-digest for in-depth analysis. 3. Optimizing slow queries can be achieved through index optimization, query rewriting and avoiding the use of SELECT*.

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 English version

SublimeText3 English version

Recommended: Win version, supports code prompts!

mPDF

mPDF

mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

EditPlus Chinese cracked version

EditPlus Chinese cracked version

Small size, syntax highlighting, does not support code prompt function

SAP NetWeaver Server Adapter for Eclipse

SAP NetWeaver Server Adapter for Eclipse

Integrate Eclipse with SAP NetWeaver application server.