To be precise, I am referring to MySql source code which is available under GPL2. I want to make certain modifications in the code which is actually for some custom requirement. The modified MySql server will be used as the database back-end tied to the web server so technically speaking the public will be using the modified server code. I only expect to offer service thru the Internet and not product based upon the modified server code. Do I have to make the modified MySql server code available to the public or to anyone asking for it? What if I later decide to license the compiled modified code, do I have an obligation to give the modified source code also to the client who licenses it from me?
No, you do not 'distribute copies of free software' so you are not required to provide source code. This is how many service providers are able to integrate GPL-licensed code with their proprietary code.
It is however a requirement in AGPL.
PS: that said, think twice if you really want to do this. Maintaining forks of large, complex software is hard. Even major software companies struggle to do that. E.g. many hardware vendors prefer if drivers for their hardware is accepted into mainline Linux, and pay people to do that.
Using modified GPL-licensed software on the server side for services is unproblematic in terms of licensing. You do not distribute the software and you can do on your machine whatever you want without asking anyone without any obligations - that's granted by the license.
If you however later decide to pass on the binaries built from this modified sources, then yes, you are obliged to fulfill the requirements imposed by the GPL license: You yourself would be in license violation if you make no offer for the complete corresponding sources to the binary. If you convey the modified software, you are obliged to distribute it under GPL terms (or compatible). You may also not impose further restrictions on the usage and further distribution of these modified versions. Thus your clients are only bound by the GPL in using that modified software and they are free to offer it free-of-charge for everyone to use.