Safely Stopping MySQL Server on Windows Server - mysql

Is stopping MySQL Process with net stop MySQL57 safe? We are running MySQL Server on Windows Server and would like to backup whole server with file-system approach. If we would use net stop MySQL57 would it not cause any database corruption?

Using net stop and then net start is equivalent to using the services applet in the Windows control panel.
net stop also causes the service's dependent services (if any) to stop and restart. For example, IIS Admin depends on World Wide Web, NNTP, FTP and SMTP if you have those installed and running.
net stop causes the services to shutdown "properly" and re-read the Windows registry before starting again. It's the same as restarting safely. Use the service names and not the display names (which won't work anyway).
You can also use the service controller app sc as well as net start/net stop.
You can see (or should see, if it installed properly) the MySQL service in the registry along with all others under HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\.
Hope that helps a bit.

Related

How to check mysql service running in windows

all:
I have a software automatically running as a service on windows platform, which depends on the Mysql db service .
But when the computer restarted ,sometimes the software can't connect to mysql when the mysql
service started later than my software.
So how can I check wether mysql service is running already in my software (using c++ language)?
Got to Start, search for "Services"
Open the application
Search MySQL (if 8 then its mysql80), right click and start.
Above steps are given, considering the fact you have to manually start the service.
If you just want to check that service is running, just check status of the above.

Database services on new vps

There are services like ServerPilot and many others that install on a vps that handle the lamp stack env. I'm wondering if there is a service that does this for databases. I install the service on a fresh vps and that the service would do all the heavy lifting like security, replication, separate read writes, back-ups and monitoring a long with easily setting up private network access for a set fee to use that service on my server.
Looking for a simple service to install on my own fresh vps, not RDS or Google Cloud.
Thank you!
What Does ServerPilot Really Do?
First, ServerPilot deploys complete LAMP stack on your server and that’s including world’s most used web server Apache, PHP5, and MYSQL. To make it even super, ServerPilot also installs and configures Nginx in front of Apache to achieve unbeatable speed and scalability.
Secondly, ServerPilot will secure your server with a firewall. To make it even secure, it will also update your server’s packages and make sure they stay updated all the time to avoid even single bug caused by outdated package.
Thirdly, ServerPilot also offers a premium feature to monitor real-time stats of your server’s performance including CPU, memory, disk space, and more.
What Does ServerPilot Not Do?
Meanwhile Serverpilot does not provide features related to installing, configuring and managing email and DNS. In this case you may need third-party DNS server to be able to point your domain to your VPS. Need recommendations? Try CloudFlare, PointHQ, NameCheap, etc.
Also, ServerPilot does not manage your server running other than Ubuntu.
Get more details at : http://www.servermom.org/install-manage-apache-nginx-php-mysql-easiest-serverpilot/1011/
I'm not sure about services, but assuming that your VPS is Ubuntu or some other Debian-based distro, you could perform sudo apt-get install lamp-server^ phpmyadmin on the command line to get your LAMP stack setup. This will setup Apache web server, PHP, and MySQL on your Linux server. Apache and PHP will come working out-of-the-box, and when you install MySQL, by default it asks for a root password to manage the database.
phpMyAdmin would be the key here because instead of doing all your database tasks via the command line, it provides a GUI interface in your web browser to manage databases and tables. To backup your database with phpMyAdmin, see this article.
With regards to customizations, for the firewall you can simply write a few iptables rules and for the database, you can run scheduled backups of a MySQL database by creating a cron job that runs the following command:/usr/bin/mysqldump -u dbusername -p'dbpassword' dbname > /path/backup.sql
Again, this isn't a service, but at least you wouldn't have to pay for any of the tools.
Unfortunately, there is no ultimate service than can perform all this stuff. However, you can set up this manually:
Database replication:
https://www.digitalocean.com/community/tutorials/how-to-set-up-master-slave-replication-in-mysql
Database backup:
http://www.ducea.com/2006/05/27/backup-your-mysql-databases-automatically-with-automysqlbackup/
or
https://www.backuphowto.info/how-backup-mysql-database-automatically-linux-users
Database optimization:
https://www.tecmint.com/mysql-mariadb-performance-tuning-and-optimization/
and
http://www.monitis.com/blog/101-tips-to-mysql-tuning-and-optimization/
And for the networking, this tutorial may be helpful
http://www.yolinux.com/TUTORIALS/LinuxTutorialNetworking.html

Gear to gear connection (Please read the full description first)

I have checked almost all solutions both in Openshift forum and here in stackoverflow but couldn't solve the problem.
Here is the situation
I have a php server with load balancing in one gear.
I have a second gear for mysql server along with PhpMyAdmin. At present OpenShift does not support load balancing for PhpMyAdmin, so my second gear does not have any scaling feature.
Now I want to host a php app in first gear and the database in the second gear. So how do I connect them internally (would be better if I could do it without port forwarding)? I need all the commands from the beginning to the end unfortunately.
Thank you.
You should just add the mysql cartridge to your scaled application. It will still put the mysql database on it's own gear, but it will be accessible from your scaled application using the standard mysql environment variables. You can view those variables by sshing into your application and running env | grep mysql. If you decide to run your own second gear for the mysql database (you still had to install a web cartridge anyways to do that right?) then you will either HAVE to use port forwarding for direct access, or you will have to write an API on that server that will allow your application to access the mysql database.

What is the difference between using Glassfish Server -> Local and Remote

I am using Intellij IDEA to develop my applications and I use glassfish for my applications.
When I want to run/debug my application I can configure it from Glassfish Server -> Local and define arguments at there. However there is another section instead of Glassfish Server, there is a Remote section for configuration. I can easily configure and debug my application just defining host and port variables.
So my question is why to need for Glassfish Server Local configuration(except for when defining extra parameters) and what is difference between them(I mean performance or etc.)?
There are a number of development work-flow optimizations and automation that can be performed by an IDE when it is working with a local server. I don't have a strong background in IDEA, so I am not sure which of the following they may have implemented:
using in-place|exploded|directory deployment can eliminate jar/war/ear creation in the IDE and deconstruction in the server. This can be a significant time saver.
linked to 1 is smarter redeployment. In some cases, a file change (like changing a jsp or an html file) does not need to trigger redeployment.
JDBC driver integration allows users to configure their IDE to access a DB and then propagates that configuration (which usually includes driver jars, etc.) into the server's classpath as part of deployment of an app.
access to server log files during deployment and execution.
The ability to start and stop the server... even today, you do need to restart GlassFish sometimes.
view the generated Java sources of a JSP.
Most of these features are not available with a remote server and that has a negative effect on iterative development since the break between edit and validate can be fairly long.
This answer is based on my familiarity with the work that we have done for the NetBeans/GlassFish integration. The guys at IntelliJ are smart, so I would not be surprised if they have other features that are available when you are working with a local server.
Local starts Glassfish for you and performs the deployment. With Remote you start Glassfish manually. Remote can be used to debug apps running on another machines, Local is useful for development and testing.

Hudson cmd.exe running as

Where does hudson CI get user to run the cmd.exe ?
I'm trying to start and stop some remote services on various slaves and special credentials that are different than what hudson is using are needed. I can't find a place to override the user. I've tried running the server as various users, but it doesn't change anything.
Any other ideas?
Since you want to start and stop the services on the remote machine you need to login with these credentials on the remote machine, since I haven't found a way to start and stop a service on remote machine.
There are different ways to do that. You can create a slave that runs on the remote machines with the correct credentials. You can even create more than one slave for the same machine without any issues, than you can use different credentials for the same machine. These can then fire up the net stop and net start command.
You can also use the SSH plugin. This allows you to configure pre- and post-build ssh scripts. You 'just' need and ssh server on the windows machine. The password for the connection will be stored encrypted.
Use a commad line tool. So far I haven't found a Windows on board tool to have a scripted login to the remote machine. I would use plink for that task. plink is the scripted version of putty. Putty supports different connection types. So you can also use the build in telnet service (not recommended since telnet does not encrypt the connection). Disadvantage is that you will have the password unencrypted in the job configuration.
We had a similar problem, and I resorted to using PsExec. To my advantage, our machines exist on a separate LAN, within 2 firewalls, so I was OK with unencrypted passwords floating around. I had also explored SSH w/ Putty, which seemed to work, but not straightforward.
If someone can help with single line runas command, that could work too.
You don't say how your slaves are connected to Hudson, but I'll assume it's through the "hudson slave" service, since that's probably the most popular way to connect Windows slaves.
If so, the CMD.EXE is run with the same permissions as the user running the service. This can be checked by:
1. run services.msc
2. double-click hudson-slave service
3. go to Log On tab
By default, the slave service runs as "LocalSystem", which is the most powerful account on the system. It should be able to do whatever you need it to do. (i.e. start/stop services)