phpMyAdmin crashing the MySQL host server - mysql

I have encountered this problem a couple of times, in the last few days. So, it happens occasionally. I have setup mysql on a remote machine, and there is a java program on another machine querying the database to read and write records every few seconds.
I am using phpMyAdmin to administer my database. And, at times, after running some SQL query, the mysql server stops responding. Even the pinging the host machine doesn't succeed. And, I have to ask someone with physical access to the machine to boot it up again.
I checked for log files but couldn't find them in the mysql directory. Is logging disabled by default? What is missing here? And, how can I go about troubleshooting this?
EDIT:
I was able to ping the server after some while. So, the server must have been temporarily busy. It's not a specific query but things like re-ordering the data of a table serially under the browse tab.

Use a mysqlclient to make a connection and keep it open.
I personally use the mysql from the commandline.
If the server becomes unresponsive execute
SHOW PROCESSLIST;
It will list all mysql processes and will show how long queries are waiting/executing.
Optionally use the KILL statement to terminate the query that locking the tables.
KILL $pid

I'd highly recommend using MySQL's own GUI tools for database management, for a vriety of reasons:
They have full support for InnoDB tables, including Foreign Key management
You can use database-level security to make sure only you get into your data (unlike phpMyAdmin, which at best can only be root access installed behind a .htaccess password)
It is official and supported. No extra binaries run on the server, so you run no risk of it crashing and taking the server down with it (unless your query itself is locking it...)

Related

I need connection to an Access Database from a mysql stored procedure to update tables i already create in mysql db

The access database is on server in folder. I need to create a stored procedure to connect to the access database and update the table data. It can be truncate then an insert. It is connecting via stored procedure to the access database i cannot figure out. It has to be done via a job on a schedule.
MySQL (the Sun- then Oracle- owned product) lacks the plumbing to connect to external tables unless they're on other MySQL servers. That is, it only has a FEDERATED storage engine. So, with MySQL you'll have to find some other way to handle your requirement; a MySQL event or other stored code cannot hit your Access tables.
MariaDB, the MySQL fork, has a CONNECT storage engine. It allows the server to hit external tables via ODBC, so you can hit Access with it. MariaDB is almost entirely compatible with MySQL, so maybe you can replace your MySQL server with it. The CONNECT documentation says this, however.
...these table types cannot be ranked as stable. Use them with care in production applications.
To me, that warning means don't do it!. Especially with a busy business-critical application (like a credit department might use) you don't want even a little bit of instability. If you truncate a table and then the reload fails, you'll be able to hear users yelling from the next county.
Your requirement is, I believe, to extract the contents of one (or more) Access tables and import them into a MySQL table. That kind of operation is called extract-transform-load etl. It seems you use SSIS for the purpose. That should work, because SSIS can connect to Access (of course) and to MySQL via the Connector/net or Connector/ODBC drivers.
But, scheduled SSIS packages get run from SQL Server database servers. You didn't say you have one of those at your disposal. If your org does have a production SQL Server instance, you can put your Access - to - MySQL package into it.
Otherwise you will have to figure out a way to run your scheduled etl job without relying on a database job (or event, as they're called in the MySQL world). For that you'll use the Task Scheduler on Windows, or a cronjob on a UNIX-derived OS like Linux or FreeBSD.
I bet you can do this work reliably from a Windows PowerShell script or a Linux shell script.

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

MySQL table crashes only after repair

I am using WordPress with MySQL. My site recently crashed (due to some out-of-memory problem with the database)
Once the site was up, it seemed fine, but just in case I ran "repair" (from phpmyadmin) on the DB. After that, it crashed my "wp_posts" table. I restored the DB from an older version, again - the table seemed fine. Again, I ran the "repair" and the same table crashed.
I am on a VPS server. So I don't have root access, but I can ask the web admins to check things.
Any idea what might be causing this / how to solve it?
Thanks.
This is a MySQL server configuration problem. I've had the same problem. In my case it was due to a MySQL system variable called myisam_sort_buffer_size being set to an absurdly small value (4096). This interfered with the repair table operation. In my case, the wp_posts file and others used the MyISAM access method. If yours use InnoDB, you'll want to look at the variables controlling that access method rather than MyISAM.
Issue this command to your MySQL server:
show variables like '%buffer_size'
Then look for variables which seem low.
You may also want to look at the MySQL server error log file.
If you run the server yourself, please be careful making configuration changes: Read the doc page first. http://dev.mysql.com/doc/refman/5.6/en/server-system-variables.html
If your hosting provider runs the server, put in a request ticket, ask that it be escalated to a support person who knows about MySQL, and be specific about what is going wrong.

Remote backup of MySQL database

Our Java server application logs data to a SQL database, which may or may not be on the same machine. Currently we use MS SQL Server, and we're now porting to MySQL. A user configures database backup parameters on our app server, e.g. time of day to run a backup, and the app server executes SQL Server's BACKUP DATABASE command at the appropriate time, via a sproc. It does incremental backups daily and full backups weekly.
MySQL lacks an equivalent feature to tell the database from a client connection to back itself up. Options we're considering are:
Create a UDF to shell out to mysqldump (or copy database files), which can be called from our app server via a sproc. Essentially we'd be implementing a version of BACKUP DATABASE for MySQL.
Create a service to run on the MySQL box that can get the backup settings from the app server and run mysqldump (or file copy) locally.
Create a backup sproc to mimic mysqldump, e.g. SHOW CREATE TABLES and SELECT INTO OUTFILE for each table.
Setting up a cron job, Perl script, third-party app or other tricks that'd work great in a data center aren't preferred; this is a shrink-wrap package that needs to be pretty robust and hands off.
Database sizes can range from roughly 10MB to 10GB.
I'm aware of the binary logs for the incremental piece. I figure the general solution will probably apply to them as well, if we decide to use them.
This is all on Windows 2003 32-bit or 2008R2 64-bit, MySQL 5.1.
The UDF option seems the best to me. The UDF Repository (http://www.mysqludf.org/) has mysqludf_sys, which may be all we need, but I thought I'd ask for opinions since after extensive googling it doesn't seem like others have reached the same conclusion, or maybe our needs are just out of the ordinary. Our app is the only thing in MySQL, so I'm not worried about other users having access to our UDF.
Any solutions I'm overlooking? Any experience with using UDFs in such a way?
Thanks,
Eric
For this an other reasons we decided to collocate our application with the database, so this problem became moot.

MySQL Instrumentation using mysql_proxy

I want a simple way to see what commands are being sent to MySQL. I have several MySQL projects that sometimes have a few messy layers of code. I want something like SQL Server Profiler without all of the bells and whistles. I just need to see the SQL traffic. Not analyze which queries are executed most often.
I found MySQL Proxy and can't get it to work in Windows. I downloaded their binaries, and tried their first example LUA script from the link. It loads fine, but when I try to connect to port 4040 using mysql, I get:
ERROR 1105 (HY000): #07000MySQL Proxy Lua script failed to load. Check the error log.
What error log? I didn't even give it the credentials to connect to my real SQL Server. What can I do to get this to work? I'm open to other options (hopefully not sniffing traffic, but maybe if someone can make it easy).
Enable query logging in my.ini. this will write all queries to a log file
add the line
log = [querylog_filename]
Then restart the mysql service
using a program such as tail for win http://tailforwin32.sourceforge.net/ will allow you to watch the queries as they run.
if you have a problematic query you can enable slow logging as well. which will log important details about queries that take a long time to run
DC