Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6851289
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T01:13:47+00:00 2026-05-27T01:13:47+00:00

I am developing Rails v2.3 app. and using MySQL v5.1 . I need to

  • 0

I am developing Rails v2.3 app. and using MySQL v5.1 .

I need to stop and start mysql database in one of my rake task, but I am not sure how to implement this thing, could some one help me?

namespace :db do
  task :some_db_task => :environment do
       #shut down mysql
       ...
       #start mysql 
  end
end

By the way, I am developing on Ubuntu machine.

———————– update —————————-

I tried exec "/etc/init.d/mysql stop" , I got the following error message:

Rather than invoking init scripts through /etc/init.d, use the service(8)
utility, e.g. service mysql stop

Since the script you are attempting to invoke has been converted to an
Upstart job, you may also use the stop(8) utility, e.g. stop mysql
stop: Rejected send message, 1 matched rules; type="method_call", sender=":1.78" (uid=1000 pid=6331 comm="stop) interface="com.ubuntu.Upstart0_6.Job" member="Stop" error name="(unset)" requested_reply=0 destination="com.ubuntu.Upstart" (uid=0 pid=1 comm="/sbin/init")) 

I tried /etc/init.d/mysql stop also on command line, the same error raise,

By following the error message’s instruction, I then tried service mysql stop , I got a new error message:

stop: Rejected send message, 1 matched rules; type="method_call", sender=":1.79" (uid=1000 pid=6343 comm="stop) interface="com.ubuntu.Upstart0_6.Job" member="Stop" error name="(unset)" requested_reply=0 destination="com.ubuntu.Upstart" (uid=0 pid=1 comm="/sbin/init"))

why I can not stop mysql??

————— update 2 ————————-

I realize that even though the above mentioned error message shows, the sudo /etc/init.d/mysql stop actually done its job. The MySQL get stopped by this command, meanwhile the message raising.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T01:13:48+00:00Added an answer on May 27, 2026 at 1:13 am

    I’d prefer using system(“sudo /etc/init.d/mysqld stop”) so you can be sure the database has stoped. system() waits for the command to be executed while exec starts a background thread.

    @update you may need “sudo service mysql stop” if you are using ubuntu lucid or newer

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using MySQL v5.1. I am developing a Rails app. and writing a
I am developing Rails v2.3 app. and using MySQL v5.1 on Ubuntu machine. I
I am developing a web app (using rails) that I will be launching within
I'm using the RESTful authentication Rails plugin for an app I'm developing. I'm having
I am currently developing a Rails application using a database that was designed before
I am developing a Rails app using OmniAuth, OmniAuth-salesforce and this gem: https://github.com/heroku/databasedotcom I
I have started developing a new Rails app on my server using RVM, Rails
I'm developing a rails 3.0.9 app, I'm using accept nested attributes for to add
I have a Rails 3 app I'm developing with a team using Git/Github and
I'm developing a Rails 3 app on Ubuntu 10.10 and need to check the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.