Can I run my own instance of MySQL? - mysql

I'm trying to migrate a web site to friend's server. The site uses MySQL, but he didn't previously have it set up. He's installed the package now and suggested that I could run my own instance of it. I'm at a loss for how to do so. Is it even possible? If so, how?
Some relevant information:
The OS in use is CentOS 5.9
Using MySQL 5.0.95
I only need the DB to be read locally via PHP when serving my site.
I have no root privileges on this system (although a full shell), but am close friends with the owner/administrator if that's necessary.
To clarify:
It's the daemon that I want to run my own instance of. So I guess what I want to know is if it's possible to have multiple users on the system running their own instances of mysqld containing different databases.
All I need this for is serving a web page. If I have to break down and switch to a pseudo-database using CSV files I will, but I'd much rather stick to MySQL if I can.

If MYSQL is setup on that machine yes you can run your own instance of it.
You can have it set up and your site given its on Database within that MYSQL instance and that specific MYSQL account can be used to access the tables etc. involved with your website.
Now if he is only putting MYSQL on the machine then having you set everything up you will just need an account for MYSQL and from ther eyou can get in and just create all the needed items that will allow your site to fully function.
EDIT
In response to your comment. You can you just can't clog the same port or have configurations that conflict each other. As long as it won't be to much of a performance hit and you configure a different user to start each instance you should be able to do Something like this.

Related

How do I migrate a SQLAnywhere 9 db running in a remote server into a mysql server on my machine?

I am working at a company that has some CRM software running in a remote Windows XP server that uses a SQLAnywhere 9 db to store its data; I have access to this remote server with an administrator account.
I would like to extract the db into a .sql file so that I can run the db locally on my machine without affecting the running db in the server (since it is key for the company's day to day operation).
The reason I need this is that we are going to test some BI Software and we need data from this database to test it, but we don't know the structure of the database since the developers of the CRM software didn't give us any documentation on it. So we need to have the database locally so that, without affecting the running CRM, we can:
understand the structure by looking at the DDL
make queries to it to get sample data
I researched a bit, and the most common solution to my problem was to use dbunload on the remote server to unload the db into a reload.sql file that contained what I needed. But most tutorials on the subject mention that I have to stop the db first (which would be catastrophic). If this is the only option, then I guess I am willing to do it on the weekend when the CRM is not used, but I wanted to know if there was another solution first.
If there is no other solution, can you point me to where I can find the proper and safer way to do this?
I have researched a lot, but prior to this day I have never even heard of SQLAnywhere, so I really need all the help I can get. My main concern is doing something that impacts negatively the CRM software.
Thank you.
You can run dbunload across the network, you just have to tell it to do an "external" unload. The default is to do an internal unload which would only work from the machine where the database server is running.
I don't have SQL Anywhere 9 documentation right now to look up the exact switch, but dbunload -? should show you all the possible switches.
Edit:
-an will create a new database and load the data and schema from another data
-xi switch will do external unload and internal reload.
-c parameters to connect to your remote database

How can I create a secondary database to run alongside my MediaWiki server?

Firstly, my aim is to create a database to store statistical information about my wiki articles, that is derived using extensions that I have written for my MediaWiki server. Then via another extension on my server, I wish to access this secondary database and use the information to edit the output of the final article page.
I wanted to try and make a separate database to avoid introducing errors to the existing MediaWiki schema. Is this possible? I can't find any information about running an additional mySQL database alongside a MediaWiki installation.
I feel as though the better solution may be to add a table to the existing schema, but I'm not sure how to deal with the existing infrastructure without breaking it. I believe I can just use standard CREATE commands but mySQL is unfortunately not my strong point.
Thanks
Hope i understood your problem. say you have media wiki server or a mysql server running on port 3308 and you want to create another mysql instance.
Follow this step:
bkp my.cnf file
start first instance on port 3308
chnage my.cnf settings & make it run on 3307
start second instance of mysql
If you have good h/w,swap/RAM, you can easily create such 4-5 instances & all will be running good.
You can run a separate database along with the primary MediaWiki database. You just have to open a connection to it specifically using the PHP MySQL API.
Adding a new table to the existing database though is really easy and probably your best bet. You will be able to take advantage of the built-in database load balancing if your site ever gets big. To learn how to create a new table from an extension, check out this page of documentation.

mysql: keeping local mysql database and remote server database synced up

I am kind of a amateur at web development. But it seems like most people develop on their local machines and the upload to their remote servers when everything is ready. I want to start doing this. I've installed Xampp (Apache) on my local machine. But in order for this to really work, i need the the mysql databases that already exist on my remote server to be "synched" or "duplicated" on my local machine. But I'm finding this somewhat hard to figure out.
First, Should I be using mysql "reduplication" feature (with my remote server as master) and local machine as slave? Or is there a better way to do this? Should I be synchronizing instead of reduplicating
Second, Is anyone willing to give me a quick description of how I achieve this "reduplication" or "synchronization"
Thanks
It may be tempting, but it's hopeless to try to keep the database in two places. Instead, always keep the database on the server because it's much easier to develop and debug your code if it's in just one place. "Resynch" and "reduplicate" and all that business is just too much trouble, as you are discovering. The DB is going to end up on the server anyway, so you may as well put it there right now.
Also, you will not need a web server on your local machine, which will unburden you.
This next is applicable if you are writing CGI. If you aren't sure whether or not you are writing CGI, then you are not (well, probably not). {
If you mainain just one database and it lives on your server, you'll be able to write one piece of portable code that will run equally well on your local machine and on your server. This is a huge win, take my word for it.
To get this working, you will need the mysql library on your local machine; no other mysql component is needed there. The mysql server will run on your server only.
Read up on mysql "connector" for the language you're using.
}

Magento Module install SQL not running

I have written a module that is refusing point blank to create the tables within my mysql4-install-1.0.0.php file....but only on the live server.
The funny thing is that on my local machine (which is a mirror of the live server (i.e. identical file structure etc)) the install runs correctly and the table is created.
So based on the fact that the files are the same can I assume that it is a server configuration and or permissions problem? I have looked everywhere and I can find no problems in any of the log files (PHP, MySQL, Apache, Magento).
I can create tables ok in test scripts (using core_read/write).
Anyone see this before?
Thanks
** EDIT ** One main difference between the 2 environments is that on the live server the MySQL is remote (not localhost). The dev server is localhost. Could that cause issues?
Is the module which your install script is a part of installed on the live server? (XML file in app/etc/modules/, Module List Module for debugging.)
Is there already a record in the core_resource table for your module? If so, remove it to set your script to re-run.
If you file named correctly? The _modifyResourceDb method in app/code/core/Mage/Core/Model/Resource/Setup.php is where this file is include/run from. Read more here
Probably a permissions issue - a MySQL account used by public-facing code should have as few permissions as possible that still let it get the job done, which generally does NOT allow for creating/altering/dropping tables.
Take whatever username you're connecting to mysql with, and do:
SELECT User, Host
FROM mysql.user
WHERE User='your username here';
This will show you the user#host combos available for that particular username, then you can get actual permissions with
show grants for username#host;
Do this for the two accounts on the live and devlopment server, which will show you what permissions are missing from the live system.
In the Admin->System->Advanced section is your module present and enabled?
Did you actually unpack your module to the right space, e.g. app/code/local/yourcompany/yourmodule ?
Do you have app/etc/modules/yourmodule.xml - I believe that this could be the overlooked file giving rise to your problem.
the cache could be the culprit, if you manually deleted the core_resource row for your module in order to make the setup sql run again, you have to also flush the cache
probably a difference between dev and production servers is cache settings, that would explain why you only see this in production
For me, the issue appeared using Windows for development. Linux system is case sensitive. In my config.xml the setup section was named camelCase while the folder was named all-lowercase. Making them the same made the script run.

Multiple MySQL versions

We have a Linux server running Red Hat Enterprise 3 and MySQL 3.23. This server has a number of websites on it.
We have a new website that we want to put on this server that uses MySQL 4/5. Is it possible to run the two versions of MySQL in parallel?
If so, how?
Yes you can. Of course on of the servers would have to use non-standard port number.
See the documentation http://dev.mysql.com/doc/refman/5.1/en/multiple-unix-servers.html
Yes, it's possible, but tricky.
Firstly, it's probably best not to use the RedHat supplied RPMS - they'll cause all sorts of dependency issues.
In essence, all you need to do is to build the two versions, and install them into completely different directories.
Then you need to make sure that they're configured with separate:
data directories
TCP ports
Local connection sockets
PID state files
In practise that can be done my creating two my.cnf files, and making sure those are chosen in the command line parameters in the daemon start up scripts.
Note also that you'll need to be very careful with any shared libraries that might get built, particularly if you're running any client applications on the same server.
This gets nasty if, for example, you want Perl::DBD::mysql running, as it's not simple to arrange for there to be two copies, with each linked against a different version of the shared libraries.