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.
Related
First ever Stack Overflow post, thanks for your time. Any constructive criticism on how to post better, please just let me know. I have done a search on my query and have found similar posts, but I was unable to use the information within them to resolve my problem.
I have created a mysql database using the terminal window in my Ubuntu system (which I am also new to, having been a lifelong windows user). I used the following code in the terminal window:
$ mysql -u root -p
Then once in mysql, I did the following
CREATE DATABASE securities_master;
USE securities_master;
I created a user and tables in the database using some other code, that doesn't seem relevant here, so I won't bother posting. However, I then decided I would like to take a look at the tables in the database, so I downloaded an SQLite browser. It was at this point that I realized I could not find my database file.
I tried to find the answer on previous stack overflow posts, and tried the suggestions of:
locate sqlite
locate .db
locate .sqlite
locate securities_master
But unfortunately, none of these showed the file I was looking for. The only place I can think of would be what is called the 'root' directory in my computer, but the Ubuntu file manager system won't let me view it because it says I don't have permissions. Is this where it might be?
Could someone shed some light on where I might be able to find this file/database? I know it is definitely there because if I try to CREATE it again, I get the message that it can't because it already exists.
Thanks again.
sqlite and mysql are two different databases. You can't use sqlite on a mysql database. sqlite is a single-file database, in which users just open the file and read and write to it, while mysql is a more traditional relational database system with a server and a client, where the server manages the database (which is generally in a directory of files), while the client just connects to the server.
Where the mysql database is located my depend on your system, but it's usually in /var/lib/mysql. You can look in /etc/mysql/my.cnf for the configuration file, which should have a datadir option that refers to where the actual data for the database is stored.
You can check my.ini file to see where the data folder is located.
Usually there is a folder {mysqlDirectory}/data
MySQL data storage:
Commands.frm
Commands.myd
Commands.myi
The *.frm files contain the table definitions. Your *.myi files are MyISAM index files. Your *.myd files contain the table data.
as mentioned in the answer before mine, mysql and sqlite are two different systems.
You mention you used the cmd line mysql to create the database and then wanted to view the tables. If you're simply trying to see which table are created, in the same command line you used to Create the database you can run show tables;
If you're after a GUI for this, we'd need a bit more context. Is this ubuntu system a remote server, or are you using the desktop version?
You say you're a long time windows user, If you're using windows locally, I personally like SQLWorkbench for accessing my remote mysql servers.
EDIT: I just re-read your post and realised you're using local ubuntu desktop so me mentioning remote was silly, my bad! However, SQLWorkbench does have a ubuntu version at https://dev.mysql.com/downloads/workbench/
I am having a problem backing up a database. I’m moving between vps providers and usually would use the WHM transfer tool. I did it this time also but got database error messages after the transfer and when I compared the 2 databases I noticed that the newer one was 200Mb smaller than the old one n the old server so I have been trying to take a manual backup but I’m having the same problem..
The original database is 1.1Gb. I’ve tried dumping it via command line, exporting from phpmyadmin, cpanel backups etc but each time I`m left with a smaller database.
I have checked both old and new databases, all the tables are backing up fine but its the contents of them which are not fully backing up. which makes me think it may be a timeout issue, .. But I am not 100% sure. I have tried changing settings in php.ini and my.cnf but I am not totally sure what is causing the prob.
Any advice would be greatly appreciated
This is a bit of a problem! I had shut down an instance on SQL Server and today I started it up again.
However one of the databases (the main one that I work with) is not accessible.
When I attempt to expand the database in SSMS to view tables, I get the error:
The database is not accessible. (objectExplorer)
I found this article which looked like it may solve the issue (assuming that it is a permissions issue) but that did not work either: http://sqlserver-help.com/2012/02/08/help-i-lost-sa-password-and-no-one-has-system-administrator-sysadmin-permission-what-should-i-do/
In the SQL Server error logs I am seeing:
FCB:Open failed: Could not open file E:\\.mdf for file number 1. OS error: 32 The process cannot access the file because it is being used by another process.
There is plenty disk space and so I am stuck with what the issue is.
I do have a recent backup so I'm not overly concerned about losing this database but still - I would like to be able to recover it if at all possible.,
Any help appreciated.
UPDATE - I used ProcessExplorer which showed that sqlservr.exe is using the file EVEN AFTER STOPPING THE SERVICE!
When I attempt to detach the database I get an error about Primary files do not match or that log file is from different database. Confusing!
Thanks.
No idea what the issue was still - but it was resolved by rebuilding the log file.
I can not use MySQL. MySQL is on my local computer. Currently I added skip-grant-tables in My.ini so I can use MySQL. But I have no privilege to create a new database. My problem is tough, although I asked related questions on SO, but no answer can resolve my problem. I almost give up. So I lower my expectation. I am developing a website, so I need to create database, tables and operate tables. You don't have to consider security. Is there a simple solution that can give me privilege to create a new database? Maybe by adding some command in my.ini or something? You won't need to completely resolve my problem. Maybe after the development, I will upload the database and tables to another server(The current database server is my personal computer, windows XP) so I can uninstall and reinstall MySQL.
The root of problem is that I lack privileges.
I'm not sure if this will work for you, since you might need to have elevated privileges in the first place, but it's worth a shot.
There should be a database called mysql. Take a look in there, and you'll see a table called users. For each record, there's a heap of columns named Select_priv, Insert_priv, etc. For your user record, change each of these to "Y".
It sounds a bit like your installation went astray.
Maybe uninstall/resinstall is your best option, assuming that you've never been able to connect, so there is no data to consider.
Take your time on the installation, and have a look at MySQL Postinstallation Notes
you have 4 questions open about this specific problem. instead of opening duplicates, you should instead update just one of them with new information.
but the simple solution to your problem is to download the ZIP file of mysql for your mysql version from the mysql website and just copy the data\mysql folder in to your data file, then restart the service. this will give you a root user with a blank password that has full access.
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...)