<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Admins Goodies &#187; mysql</title>
	<atom:link href="http://adminsgoodies.com/tag/mysql/feed/" rel="self" type="application/rss+xml" />
	<link>http://adminsgoodies.com</link>
	<description>Just another WordPress site</description>
	<lastBuildDate>Fri, 24 May 2013 16:33:10 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.1</generator>
		<item>
		<title>Making a mysql dump causes web application to hang.</title>
		<link>http://adminsgoodies.com/making-a-mysql-dump-causes-web-application-to-hang/</link>
		<comments>http://adminsgoodies.com/making-a-mysql-dump-causes-web-application-to-hang/#comments</comments>
		<pubDate>Wed, 23 Jan 2013 17:34:40 +0000</pubDate>
		<dc:creator>tom</dc:creator>
				<category><![CDATA[General Questions]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[mysqldump]]></category>

		<guid isPermaLink="false">http://adminsgoodies.com/making-a-mysql-dump-causes-web-application-to-hang/</guid>
		<description><![CDATA[Can the following command on a live server mysqldump -h XXXX -u root -pXXXXX --skip-opt --flush-privileges --flush-logs --routines --triggers --allow-keywords --create-options --add-locks --quick --single-transaction --extended-insert --all-databases cause a web application (which relies on databases of server) to hang? Asked by Alex Some possibilities: MyISAM tables only support table-level locking, so while your mysqldump is reading the table, any writes will be queued up until it&#8217;s finished. If a write gets queued, any other reads will [...]]]></description>
				<content:encoded><![CDATA[<h3 class="pq"><img src="http://adminsgoodies.com/imgs/question.png" alt="Question" /></h3>
<p>Can the following command on a live server</p>
<pre class="prettyprint"><code>mysqldump -h XXXX -u root -pXXXXX --skip-opt --flush-privileges 
    --flush-logs --routines --triggers --allow-keywords 
    --create-options --add-locks --quick --single-transaction 
    --extended-insert --all-databases
</code></pre>
<p>cause a web application (which relies on databases of server) to hang? </p>
<div class="author">Asked by <a href="http://serverfault.com/users/48782/alex" target="_blank">Alex</a></div>
<h3 class="pa"><img src="http://adminsgoodies.com/imgs/answer.png" alt="Answer" /></h3>
<p>Some possibilities:</p>
<ul>
<li>
<p>MyISAM tables only support table-level locking, so while your <code>mysqldump</code> is reading the table, any writes will be queued up until it&#8217;s finished.  If a write gets queued, any other <em>reads</em> will then be queued up behind the write, effectively locking the application.  There&#8217;s nothing special about <code>mysqldump</code> in this sense, it&#8217;s just a single <code>SELECT * FROM table</code> that takes long enough for a write to happen and get queued.</p>
</li>
<li>
<p>InnoDB tables support row-level locking, meaning that reads and writes can be interleaved as long as they don&#8217;t touch the same rows.  There are some query types that do lock the entire table (such as <code>ALTER table ...</code>) but if you were running these frequently they would have caused troubles long before <code>mysqldump</code> did.</p>
</li>
<li>
<p>A <code>mysqldump</code> can also cause a lot more disk access than usual.  It is effectively reading in your entire database and writing it back out again, probably to the same physical disk.  Reading from and writing to the same physical disk is going to cause extra latency (unless they are SSDs) because the parts of the disk that you are reading from and writing to have to be different and hence there will be more seeks, which take time.  This will raise the load average on your box and will cause any other operations that require disk access to go slower.</p>
</li>
<li>
<p>Most databases store more data than they have RAM.  Your <code>mysqldump</code> may well have flushed your filesystem cache and filled it with mostly useless data, meaning that other disk access requests will have to come from the actual disks (which have excess latency at the time) rather than coming from the much faster cache.  It may have also flushed caches within MySQL, depending on the limits you have set up for each of them.</p>
</li>
<li>
<p>Depending on your MySQL config, the <code>mysqldump</code> that touches every table may have cause MySQL to use more RAM than you have available.  This would cause some of your active RAM to be swapped out to disk, further increasing the disk utilisation and having an enormous impact on performance.</p>
</li>
</ul>
<p>Run <a href="https://github.com/rackerhacker/MySQLTuner-perl" rel="nofollow">mysqltuner.pl</a> on your system to help tune your config and consider switching to InnoDB rather than MyISAM if you are currently using MyISAM.  Try streaming your backups straight off to your backup server rather than writing them to the same disk.  (This can be achieved many ways but this works: <code>mysqldump [OPTIONS] | gzip | ssh "cat - &gt; database_backup.$(date +%F).sql.gz" &lt;BACKUPHOST&gt;</code>)  If (or once) you are on InnoDB, you can use <a href="http://www.percona.com/doc/percona-xtrabackup/" rel="nofollow">Percona&#8217;s XtraBackup</a> as a better backup tool that is roughly as efficient as a pure file copy and can be used to initialise replication.  XtraBackup can stream directly to another server as well.</p>
<div class="author">Answered by <a href="http://serverfault.com/users/26130/ladadadada" target="_blank">Ladadadada</a></div>
<p class="ref-link">Check <a href="http://serverfault.com/questions/471648/making-a-mysql-dump-causes-web-application-to-hang" target="_blank">more discussion</a> of this question.</p>
]]></content:encoded>
			<wfw:commentRss>http://adminsgoodies.com/making-a-mysql-dump-causes-web-application-to-hang/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MySQL Error &#8211; Can&#8217;t connect to local MySQL server through socket</title>
		<link>http://adminsgoodies.com/mysql-error-cant-connect-to-local-mysql-server-through-socket/</link>
		<comments>http://adminsgoodies.com/mysql-error-cant-connect-to-local-mysql-server-through-socket/#comments</comments>
		<pubDate>Wed, 23 Jan 2013 17:34:00 +0000</pubDate>
		<dc:creator>tom</dc:creator>
				<category><![CDATA[General Questions]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://adminsgoodies.com/mysql-error-cant-connect-to-local-mysql-server-through-socket/</guid>
		<description><![CDATA[Sometimes on my VPS I get the error Warning: mysql_pconnect(): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (111) in /var/www/mysql.php on line 8 It can be solved by restarting MySQL several times, restating the sever or sometimes using mysqld command. Using the mysqld command I get the following: root@web:~# mysqld 130109 10:47:23 [Note] Plugin 'FEDERATED' is disabled. 130109 10:47:23 InnoDB: The InnoDB memory heap is disabled 130109 10:47:23 InnoDB: Mutexes and rw_locks use [...]]]></description>
				<content:encoded><![CDATA[<h3 class="pq"><img src="http://adminsgoodies.com/imgs/question.png" alt="Question" /></h3>
<p>Sometimes on my VPS I get the error</p>
<pre class="prettyprint"><code>Warning: mysql_pconnect(): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (111) in /var/www/mysql.php on line 8
</code></pre>
<p>It can be solved by restarting MySQL several times, restating the sever or sometimes using <strong>mysqld</strong> command.</p>
<p>Using the <strong>mysqld</strong> command I get the following:</p>
<pre class="prettyprint"><code>root@web:~# mysqld
130109 10:47:23 [Note] Plugin 'FEDERATED' is disabled.
130109 10:47:23 InnoDB: The InnoDB memory heap is disabled
130109 10:47:23 InnoDB: Mutexes and rw_locks use GCC atomic builtins
130109 10:47:23 InnoDB: Compressed tables use zlib 1.2.3.4
130109 10:47:23 InnoDB: Initializing buffer pool, size = 128.0M
130109 10:47:23 InnoDB: Completed initialization of buffer pool
130109 10:47:23 InnoDB: highest supported file format is Barracuda.
InnoDB: The log sequence number in ibdata files does not match
InnoDB: the log sequence number in the ib_logfiles!
130109 10:47:23  InnoDB: Database was not shut down normally!
InnoDB: Starting crash recovery.
InnoDB: Reading tablespace information from the .ibd files...
InnoDB: Restoring possible half-written data pages from the doublewrite
InnoDB: buffer...
130109 10:47:24  InnoDB: Waiting for the background threads to start
130109 10:47:25 InnoDB: 1.1.8 started; log sequence number 43428438
130109 10:47:25 [Note] Server hostname (bind-address): '0.0.0.0'; port: 3306
130109 10:47:25 [Note]   - '0.0.0.0' resolves to '0.0.0.0';
130109 10:47:25 [Note] Server socket created on IP: '0.0.0.0'.
130109 10:47:25 [Note] Event Scheduler: Loaded 0 events
130109 10:47:25 [Note] mysqld: ready for connections.
Version: '5.5.28-0ubuntu0.12.04.3'  socket: '/var/run/mysqld/mysqld.sock'  port: 3306  (Ubuntu)
130109 10:47:25 [ERROR] mysqld: Table './sever/table' is marked as crashed and should be repaired
130109 10:47:25 [ERROR] mysqld: Table './sever/table' is marked as crashed and should be repaired
130109 10:47:25 [ERROR] mysqld: Table './sever/table' is marked as crashed and should be repaired
130109 10:47:25 [Warning] Checking table:   './sever/table'
</code></pre>
<p>My get only 50 visitors a day and uses more than 3000 queries per hour.<br />
My VPS is only 1 core with 256MB ram and runs on Ubuntu 64bit.</p>
<p>MySQL downtimes directly affect my website and I can&#8217;t find a answer anywhere.</p>
<p>Thanks in Advance <img src='http://adminsgoodies.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<div class="author">Asked by <a href="http://serverfault.com/users/132515/msankalpa" target="_blank">msankalpa</a></div>
<h3 class="pa"><img src="http://adminsgoodies.com/imgs/answer.png" alt="Answer" /></h3>
<p>I just upgraded to 512MB of Ram and it stopped. I think it is the OOM-killer mentioned by Ladadadada. you can see a Anseer for the OOM-Killer <a href="http://serverfault.com/a/399838/26130">here.</a></p>
<div class="author">Answered by <a href="http://serverfault.com/users/132515/msankalpa" target="_blank">msankalpa</a></div>
<p class="ref-link">Check <a href="http://serverfault.com/questions/464351/mysql-error-cant-connect-to-local-mysql-server-through-socket" target="_blank">more discussion</a> of this question.</p>
]]></content:encoded>
			<wfw:commentRss>http://adminsgoodies.com/mysql-error-cant-connect-to-local-mysql-server-through-socket/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Incrementing values, alternate way of doing this that won&#8217;t use MySQL</title>
		<link>http://adminsgoodies.com/incrementing-values-alternate-way-of-doing-this-that-wont-use-mysql/</link>
		<comments>http://adminsgoodies.com/incrementing-values-alternate-way-of-doing-this-that-wont-use-mysql/#comments</comments>
		<pubDate>Mon, 21 Jan 2013 17:33:53 +0000</pubDate>
		<dc:creator>tom</dc:creator>
				<category><![CDATA[General Questions]]></category>
		<category><![CDATA[apc]]></category>
		<category><![CDATA[memcache]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://adminsgoodies.com/incrementing-values-alternate-way-of-doing-this-that-wont-use-mysql/</guid>
		<description><![CDATA[I need to count impressions of a .php script that is accessed via web. Right now I do this in a 1 line MySQL table and just increment the value. This works fine usually but when the server has traffic bursts (hundreds of requests/second) everything gets delayed and the increment SQL statements start to pop up in MySQL&#8217;s slow queries log. I tried to count via APC but it &#8220;loses&#8221; values, that is, when I [...]]]></description>
				<content:encoded><![CDATA[<h3 class="pq"><img src="http://adminsgoodies.com/imgs/question.png" alt="Question" /></h3>
<p>I need to count impressions of a .php script that is accessed via web. Right now I do this in a 1 line MySQL table and just increment the value. This works fine usually but when the server has traffic bursts (hundreds of requests/second) everything gets delayed and the increment SQL statements start to pop up in MySQL&#8217;s slow queries log.<br />
I tried to count via APC but it &#8220;loses&#8221; values, that is, when I run a simple ab test command like  </p>
<pre class="prettyprint"><code>ab -n 100 -c 10 http://example.com/script.php
</code></pre>
<p>only ~50 new impressions are counted while on MySQL 100 are counted.<br />
I also tried to count impressions via <strong>memcache</strong>, it works better (that is, its able to keep up with more simultaneous connections) but it also fails to count everything after 50 or 100 simultaneous connections.    </p>
<p>I was wondering if there is anybody aware of a good solution to this problem?</p>
<div class="author">Asked by <a href="http://serverfault.com/users/126044/alex-flo" target="_blank">Alex Flo</a></div>
<h3 class="pa"><img src="http://adminsgoodies.com/imgs/answer.png" alt="Answer" /></h3>
<p>In the end I chose to use a MEMORY table instead the usual INNODB one. While the solution isn&#8217;t perfect it works much better than just using INNODB for this. I also applied this solution on a number of other tables where data integrity wasn&#8217;t crucial and the results were positive.</p>
<div class="author">Answered by <a href="http://serverfault.com/users/126044/alex-flo" target="_blank">Alex Flo</a></div>
<p class="ref-link">Check <a href="http://serverfault.com/questions/469274/incrementing-values-alternate-way-of-doing-this-that-wont-use-mysql" target="_blank">more discussion</a> of this question.</p>
]]></content:encoded>
			<wfw:commentRss>http://adminsgoodies.com/incrementing-values-alternate-way-of-doing-this-that-wont-use-mysql/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How can I make mysql recognize root user after install?</title>
		<link>http://adminsgoodies.com/how-can-i-make-mysql-recognize-root-user-after-install/</link>
		<comments>http://adminsgoodies.com/how-can-i-make-mysql-recognize-root-user-after-install/#comments</comments>
		<pubDate>Sun, 20 Jan 2013 17:34:39 +0000</pubDate>
		<dc:creator>tom</dc:creator>
				<category><![CDATA[General Questions]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[user-accounts]]></category>

		<guid isPermaLink="false">http://adminsgoodies.com/how-can-i-make-mysql-recognize-root-user-after-install/</guid>
		<description><![CDATA[I just installed MySQL 5.5 and right after install I was asked to set root password by executing those two commands: /usr/bin/mysqladmin -u root password 'new-password' /usr/bin/mysqladmin -u root -h linux-opxd password 'new-password' or /usr/bin/mysql_secure_installation I executed first command &#8212; OK. I executed second command this time with error: error: &#8216;Access denied for user &#8216;root&#8217;@'localhost&#8217; (using password: NO)&#8217; I re-executed the first one (for checking) &#8212; error as above. So, I executed mysql_secure_installation. Everything went [...]]]></description>
				<content:encoded><![CDATA[<h3 class="pq"><img src="http://adminsgoodies.com/imgs/question.png" alt="Question" /></h3>
<p>I just installed MySQL 5.5 and right after install I was asked to set root password by executing those two commands:</p>
<pre class="prettyprint"><code>/usr/bin/mysqladmin -u root password 'new-password'
/usr/bin/mysqladmin -u root -h linux-opxd password 'new-password'
</code></pre>
<p>or </p>
<pre class="prettyprint"><code>/usr/bin/mysql_secure_installation
</code></pre>
<p>I executed first command &#8212; OK. I executed second command this time with error:</p>
<blockquote>
<p>error: &#8216;Access denied for user &#8216;root&#8217;@'localhost&#8217; (using password:<br />
  NO)&#8217;</p>
</blockquote>
<p>I re-executed the first one (for checking) &#8212; error as above.</p>
<p>So, I executed <code>mysql_secure_installation</code>. Everything went fine and my password <strong>was</strong> recognized. So I executed the first two commands again &#8212; and error again.</p>
<p>As another check:</p>
<pre class="prettyprint"><code>mysql --user=root
</code></pre>
<p>The same error as above.</p>
<p>I tried resetting the password with mysql authentication, also I tried <code>/usr/bin/mysql_upgrade -u root -p</code> &#8212; still the error while trying to launch mysql console as root.</p>
<p>So finally I turned authentication off, connected to console and executed this:</p>
<pre class="prettyprint"><code>SELECT user();
</code></pre>
<p>The output &#8212; <code>root@</code>. If I connect like this:</p>
<pre class="prettyprint"><code>mysql --user='root@localhost'
</code></pre>
<p>I will get <code>root@localhost@</code>.</p>
<p>So for now it seems it is not the problem with privileges, or lack of password or anything like this, but no recognizing the user which was given at command line &#8212; mysql appends <code>@</code> at the end and this seems to be the problem (at least for my eye).</p>
<p>The question is: how to make MySQL recognize the given user?</p>
<div class="author">Asked by <a href="http://serverfault.com/users/49330/greenoldman" target="_blank">greenoldman</a></div>
<h3 class="pa"><img src="http://adminsgoodies.com/imgs/answer.png" alt="Answer" /></h3>
<p>The first error you have received:</p>
<blockquote>
<p>error: &#8216;Access denied for user &#8216;root&#8217;@'localhost&#8217; (using password: NO)&#8217;</p>
</blockquote>
<p>indicates that you probably did not use -p option in mysql command.</p>
<p>Once you have created mysql root password, you should be able to access MySql using:</p>
<pre class="prettyprint"><code>mysql -u root -p
</code></pre>
<p>Where you will be prompted to enter MySql root password.</p>
<p>If you want to enable access from some other location (different from the localhost) you can grant privileges using SQL GRANT commands similar to this:</p>
<pre class="prettyprint"><code>mysql&gt; CREATE USER 'username'@'localhost' IDENTIFIED BY 'some_pass';
mysql&gt; GRANT ALL PRIVILEGES ON databaseName.* TO 'username'@'localhost' WITH GRANT OPTION;
mysql&gt; FLUSH PRIVILEGES;
</code></pre>
<p>On a similar fashion, you can enable MySql DB access from some other hostname/IP address or any location by changing &#8216;username&#8217;@'localhost&#8217; to: &#8216;username&#8217;@'someFQDN&#8217;, &#8216;username&#8217;@'IP_address&#8217;, &#8216;username&#8217;@'%&#8217;.</p>
<p>For additional information I&#8217;d recommend: <a href="http://dev.mysql.com/doc/refman/5.1/en/adding-users.html" rel="nofollow">http://dev.mysql.com/doc/refman/5.1/en/adding-users.html</a>.</p>
<p>Cheers!</p>
<div class="author">Answered by <a href="http://serverfault.com/users/155239/ana-peric" target="_blank">Ana Peric</a></div>
<p class="ref-link">Check <a href="http://serverfault.com/questions/470794/how-can-i-make-mysql-recognize-root-user-after-install" target="_blank">more discussion</a> of this question.</p>
]]></content:encoded>
			<wfw:commentRss>http://adminsgoodies.com/how-can-i-make-mysql-recognize-root-user-after-install/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MySQL won&#8217;t start after creating sym link to data directory</title>
		<link>http://adminsgoodies.com/mysql-wont-start-after-creating-sym-link-to-data-directory/</link>
		<comments>http://adminsgoodies.com/mysql-wont-start-after-creating-sym-link-to-data-directory/#comments</comments>
		<pubDate>Wed, 09 Jan 2013 17:33:40 +0000</pubDate>
		<dc:creator>tom</dc:creator>
				<category><![CDATA[General Questions]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[symbolic-link]]></category>

		<guid isPermaLink="false">http://adminsgoodies.com/mysql-wont-start-after-creating-sym-link-to-data-directory/</guid>
		<description><![CDATA[I&#8217;ve moved all the stuff in /var/lib/mysql to /500gb/mysql, and created a symbolic link from one to the other. I then did a chown mysql:mysql and chmod 777 (with both -h and -R as necessary) to both the /var/lib/mysql symbolic link, and also /500gb/mysql. ls -al /var/lib gives me: lrwxrwxrwx 1 mysql mysql 15 2011-07-27 12:55 mysql -&#62; /500gb/mysql When I try to start MySQL (service mysql start), I get the following in /var/log/mysql/error.log: 110727 [...]]]></description>
				<content:encoded><![CDATA[<h3 class="pq"><img src="http://adminsgoodies.com/imgs/question.png" alt="Question" /></h3>
<p>I&#8217;ve moved all the stuff in <code>/var/lib/mysql</code> to <code>/500gb/mysql</code>, and created a symbolic link from one to the other. I then did a <code>chown mysql:mysql</code> and <code>chmod 777</code> (with both -h and -R as necessary) to both the <code>/var/lib/mysql</code> symbolic link, and also <code>/500gb/mysql</code>.</p>
<p><code>ls -al /var/lib</code> gives me:</p>
<pre class="prettyprint"><code>lrwxrwxrwx  1 mysql         mysql         15 2011-07-27 12:55 mysql -&gt; /500gb/mysql
</code></pre>
<p>When I try to start MySQL (<code>service mysql start</code>), I get the following in <code>/var/log/mysql/error.log</code>: </p>
<pre class="prettyprint"><code>110727 12:48:32 [Note] Plugin 'FEDERATED' is disabled.
/usr/sbin/mysqld: Can't find file: './mysql/plugin.frm' (errno: 13)
110727 12:48:32 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
110727 12:48:32  InnoDB: Operating system error number 13 in a file operation.
InnoDB: The error means mysqld does not have the access rights to
InnoDB: the directory.
InnoDB: File name ./ibdata1
InnoDB: File operation call: 'open'.
InnoDB: Cannot continue operation.
</code></pre>
<p>Both <code>/500gb/mysql/ibdata1</code> and <code>/500gb/mysql/mysql/plugin.frm</code> exist and are owned by <code>mysql</code>. What&#8217;s the deal?</p>
<p>Also, MySQL seems to occasionally clobber my symbolic link. It disappears and becomes a regular directory after a number of failed starts.</p>
<p>I&#8217;ve also tried editing my <code>/etc/mysql/my.cnf</code> and setting <code>datadir = /500gb/mysql</code> with no luck.</p>
<p>Any ideas? Thanks.</p>
<div class="author">Asked by <a href="http://serverfault.com/users/89239/mike-cialowicz" target="_blank">Mike Cialowicz</a></div>
<h3 class="pa"><img src="http://adminsgoodies.com/imgs/answer.png" alt="Answer" /></h3>
<p>It turns out that <code>Apparmor</code> was screwing things up. We had to edit this file: <code>/etc/apparmor.d/usr.sbin.mysql</code>.</p>
<div class="author">Answered by <a href="http://serverfault.com/users/89239/mike-cialowicz" target="_blank">Mike Cialowicz</a></div>
<p class="ref-link">Check <a href="http://serverfault.com/questions/294716/mysql-wont-start-after-creating-sym-link-to-data-directory" target="_blank">more discussion</a> of this question.</p>
]]></content:encoded>
			<wfw:commentRss>http://adminsgoodies.com/mysql-wont-start-after-creating-sym-link-to-data-directory/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MySQL reinstall questions</title>
		<link>http://adminsgoodies.com/mysql-reinstall-questions/</link>
		<comments>http://adminsgoodies.com/mysql-reinstall-questions/#comments</comments>
		<pubDate>Wed, 09 Jan 2013 17:33:24 +0000</pubDate>
		<dc:creator>tom</dc:creator>
				<category><![CDATA[General Questions]]></category>
		<category><![CDATA[lamp]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[reinstall]]></category>

		<guid isPermaLink="false">http://adminsgoodies.com/mysql-reinstall-questions/</guid>
		<description><![CDATA[For some reason my /var/run/ dir on debian6 had it&#8217;s chown and chmod changed. Problem is from what? Outcome is that mysql fails. I&#8217;m guessing the easiest way to fix is to reinstall MySQL. (Previously this LAMP was running fine.) However, I have established databases and tables and don&#8217;t want to lose them. Since mysql is not running I can&#8217;t backup (correct?). I just want to confirm that: 1). if I reinstall, I won&#8217;t loose [...]]]></description>
				<content:encoded><![CDATA[<h3 class="pq"><img src="http://adminsgoodies.com/imgs/question.png" alt="Question" /></h3>
<p>For some reason my /var/run/ dir on debian6 had it&#8217;s chown and chmod changed. Problem is from what? Outcome is that mysql fails. I&#8217;m guessing the easiest way to fix is to reinstall MySQL. (Previously this LAMP was running fine.)</p>
<p>However, I have established databases and tables and don&#8217;t want to lose them. Since mysql is not running I can&#8217;t backup (correct?).</p>
<p>I just want to confirm that:</p>
<p>1). if I reinstall, I won&#8217;t loose my databases.</p>
<p>2). <code>apt-get install mysql-server mysql-client</code> is the correct command to use.</p>
<p>Thanks.</p>
<p>EDIT:</p>
<p>/var/log/syslog output when running <code>/etc/init.d/mysql start</code>:</p>
<pre class="prettyprint"><code>mysqld_safe: Starting mysqld daemon with databases from /var/lib/mysql
mysqld: 130109 10:44:10 [Note] Plugin 'FEDERATED' is disabled.
mysqld: #007/usr/sbin/mysqld: Can't find file: './mysql/plugin.frm' (errno: 13)
mysqld: 130109 10:44:10 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
mysqld: 130109 10:44:10 InnoDB: The InnoDB memory heap is disabled
mysqld: 130109 10:44:10 InnoDB: Mutexes and rw_locks use GCC atomic builtins
mysqld: 130109 10:44:10 InnoDB: Compressed tables use zlib 1.2.3.4
mysqld: 130109 10:44:10 InnoDB: Using Linux native AIO
mysqld: 130109 10:44:10 InnoDB: Initializing buffer pool, size = 128.0M
mysqld: 130109 10:44:10 InnoDB: Completed initialization of buffer pool
mysqld: 130109 10:44:10  InnoDB: Operating system error number 13 in a file operation.
mysqld: InnoDB: The error means mysqld does not have the access rights to
mysqld: InnoDB: the directory.
mysqld: InnoDB: File name ./ibdata1
mysqld: InnoDB: File operation call: 'create'.
mysqld: InnoDB: Cannot continue operation.
mysqld_safe: mysqld from pid file /var/run/mysqld/mysqld.pid ended
/etc/init.d/mysql[4531]: 0 processes alive and '/usr/bin/mysqladmin --defaults-file=/etc/mysql/debian.cnf ping' resulted in
/etc/init.d/mysql[4531]: #007/usr/bin/mysqladmin: connect to server at 'localhost' failed
/etc/init.d/mysql[4531]: error: 'Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)'
/etc/init.d/mysql[4531]: Check that mysqld is running and that the socket: '/var/run/mysqld/mysqld.sock' exists!
/etc/init.d/mysql[4531]: 
</code></pre>
<div class="author">Asked by <a href="http://serverfault.com/users/131117/dmayo" target="_blank">dmayo</a></div>
<h3 class="pa"><img src="http://adminsgoodies.com/imgs/answer.png" alt="Answer" /></h3>
<p>it would be good to find out what really has happened; you can take a look at any other computer with the same OS and mysql installed and use chmod and chown to restore the expected rights and ownership.</p>
<p>quick look at a random debian server tells me:</p>
<pre class="prettyprint"><code>root@serv:/var/run# ls -la /var/run/mysqld/*
total 12
drwxr-xr-x  2 mysql root  4096 Oct 24 13:29 .
drwxr-xr-x 14 root  root  4096 Jan  9 01:28 ..
-rw-rw----  1 mysql mysql    5 Oct 24 13:29 mysqld.pid
srwxrwxrwx  1 mysql mysql    0 Oct 24 13:29 mysqld.sock
</code></pre>
<p>so try first:</p>
<pre class="prettyprint"><code>chown mysql:mysql /var/run/mysqld/*
chown mysql:root /var/run/mysqld 
</code></pre>
<p>and appropriate chmods if needed</p>
<p>if you decide to re-install &#8211; be on the safe side:</p>
<ul>
<li>try to shut down cleanly mysql &#8211; if needed using regular kill and waiting</li>
<li>copy all the data files [nut just few - eg not just the directory of one database; it might not be enough for innodb]</li>
<li>copy all the config files</li>
</ul>
<p>only then try to uninstall + reinstall</p>
<div class="author">Answered by <a href="http://serverfault.com/users/2413/pqd" target="_blank">pQd</a></div>
<p class="ref-link">Check <a href="http://serverfault.com/questions/464437/mysql-reinstall-questions" target="_blank">more discussion</a> of this question.</p>
]]></content:encoded>
			<wfw:commentRss>http://adminsgoodies.com/mysql-reinstall-questions/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Passing Arguments to a Service started with Init.d</title>
		<link>http://adminsgoodies.com/passing-arguments-to-a-service-started-with-init-d/</link>
		<comments>http://adminsgoodies.com/passing-arguments-to-a-service-started-with-init-d/#comments</comments>
		<pubDate>Tue, 01 Jan 2013 17:34:00 +0000</pubDate>
		<dc:creator>tom</dc:creator>
				<category><![CDATA[General Questions]]></category>
		<category><![CDATA[init.d]]></category>
		<category><![CDATA[mysql]]></category>

		<guid isPermaLink="false">http://adminsgoodies.com/passing-arguments-to-a-service-started-with-init-d/</guid>
		<description><![CDATA[I want to start mysql with the command argument &#8220;&#8211;log=log_file_name&#8221; What is the proper way to do that when starting it with /etc/init.d? Would it be like this? /etc/init.d/mysql start &#8211;log=log_file_name Asked by Jim To make it simple you can create another entry in init.d to start the mysql with that logdir path option. Make a script like /etc/init.d/mysql-log and put following entries in it: #!/bin/sh -e set -e COMMAND=$1 LOG="--log=/tmp/mysql.log" case $COMMAND in start) [...]]]></description>
				<content:encoded><![CDATA[<h3 class="pq"><img src="http://adminsgoodies.com/imgs/question.png" alt="Question" /></h3>
<p>I want to start mysql with the command argument &#8220;&#8211;log=log_file_name&#8221;</p>
<p>What is the proper way to do that when starting it with /etc/init.d?</p>
<p>Would it be like this?<br />
/etc/init.d/mysql start &#8211;log=log_file_name</p>
<div class="author">Asked by <a href="http://serverfault.com/users/149093/jim" target="_blank">Jim</a></div>
<h3 class="pa"><img src="http://adminsgoodies.com/imgs/answer.png" alt="Answer" /></h3>
<p>To make it simple you can create another entry in init.d to start the mysql with that logdir path option. Make a script like <code>/etc/init.d/mysql-log</code> and put following entries in it:</p>
<pre class="prettyprint"><code> #!/bin/sh -e
 set -e
 COMMAND=$1
 LOG="--log=/tmp/mysql.log"
 case $COMMAND in
 start)
      /etc/init.d/mysql $COMMAND $LOG
      ;;
 stop)
      /etc/init.d/mysql $COMMAND
      ;;
 restart)
      /etc/init.d/mysql stop
      /etc/init.d/mysql start $LOG
      ;;
 *)
      exit 1
 esac
</code></pre>
<p>Set the log file location in the above script as per your needs and start the mysql with the following command:</p>
<pre class="prettyprint"><code>/etc/init.d/mysql-log start 
</code></pre>
<p>This way you can use different scripts for different occasions. </p>
<div class="author">Answered by <a href="http://serverfault.com/users/148176/somesh" target="_blank">Somesh</a></div>
<p class="ref-link">Check <a href="http://serverfault.com/questions/462067/passing-arguments-to-a-service-started-with-init-d" target="_blank">more discussion</a> of this question.</p>
]]></content:encoded>
			<wfw:commentRss>http://adminsgoodies.com/passing-arguments-to-a-service-started-with-init-d/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Redirect MySQL queries to another server</title>
		<link>http://adminsgoodies.com/redirect-mysql-queries-to-another-server/</link>
		<comments>http://adminsgoodies.com/redirect-mysql-queries-to-another-server/#comments</comments>
		<pubDate>Sat, 22 Dec 2012 17:36:23 +0000</pubDate>
		<dc:creator>tom</dc:creator>
				<category><![CDATA[General Questions]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[database-performance]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[mysqlproxy]]></category>
		<category><![CDATA[query]]></category>

		<guid isPermaLink="false">http://adminsgoodies.com/redirect-mysql-queries-to-another-server/</guid>
		<description><![CDATA[I want to use another server to store my databases, so how can I redirect MySQL queries to another server? Asked by Zim3r You can use something like mysql proxy link1 link2 for it. But it&#8217;s not very well supported. Additionally, decrease in performance is somewhat significant. If possible, I would suggest you to simply tell your application to connect to the actual mysql server with a choice. For example, with PHP, there is mysqlnd_ms [...]]]></description>
				<content:encoded><![CDATA[<h3 class="pq"><img src="http://adminsgoodies.com/imgs/question.png" alt="Question" /></h3>
<p>I want to use another server to store my databases, so how can I redirect MySQL queries to another server?</p>
<div class="author">Asked by <a href="http://serverfault.com/users/126492/zim3r" target="_blank">Zim3r</a></div>
<h3 class="pa"><img src="http://adminsgoodies.com/imgs/answer.png" alt="Answer" /></h3>
<p>You can use something like mysql proxy <a href="http://dev.mysql.com/downloads/mysql-proxy/" rel="nofollow">link1</a> <a href="https://launchpad.net/mysql-proxy" rel="nofollow">link2</a> for it. But it&#8217;s not very well supported. Additionally, decrease in performance is <a href="http://www.mysqlperformanceblog.com/2009/06/09/mysql-proxy-urgh-performance-and-scalability/" rel="nofollow">somewhat significant</a>. If possible, I would suggest you to simply tell your application to connect to the actual mysql server with a choice. For example, with PHP, there is <a href="http://pecl.php.net/package/mysqlnd_ms" rel="nofollow">mysqlnd_ms</a> which allows multiple mysql servers to be added and it load balances among them.</p>
<div class="author">Answered by <a href="http://serverfault.com/users/96562/peter" target="_blank">Peter</a></div>
<p class="ref-link">Check <a href="http://serverfault.com/questions/460231/redirect-mysql-queries-to-another-server" target="_blank">more discussion</a> of this question.</p>
]]></content:encoded>
			<wfw:commentRss>http://adminsgoodies.com/redirect-mysql-queries-to-another-server/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to check if MySQL replication is using SSL</title>
		<link>http://adminsgoodies.com/how-to-check-if-mysql-replication-is-using-ssl/</link>
		<comments>http://adminsgoodies.com/how-to-check-if-mysql-replication-is-using-ssl/#comments</comments>
		<pubDate>Fri, 21 Dec 2012 17:36:43 +0000</pubDate>
		<dc:creator>tom</dc:creator>
				<category><![CDATA[General Questions]]></category>
		<category><![CDATA[mariadb]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[mysql-replication]]></category>

		<guid isPermaLink="false">http://adminsgoodies.com/how-to-check-if-mysql-replication-is-using-ssl/</guid>
		<description><![CDATA[I have a MySQL (actually mariaDB) install that I just started replicating to another server. I want to ensure that I&#8217;ve setup SSL correctly. The SSL portion of SHOW SLAVE STATUS looks like: Master_SSL_Allowed: Yes Master_SSL_CA_File: /etc/mysql/newcerts/ca-cert.pem Master_SSL_CA_Path: /etc/mysql/newcerts/ Master_SSL_Cert: /etc/mysql/newcerts/client-cert.pem Master_SSL_Cipher: Master_SSL_Key: /etc/mysql/newcerts/client-key.pem Seconds_Behind_Master: 0 Master_SSL_Verify_Server_Cert: No Is this typical or show that replication is using SSL? Is there something else I can check to ensure it&#8217;s using SSL? The slave is successfully replicating. [...]]]></description>
				<content:encoded><![CDATA[<h3 class="pq"><img src="http://adminsgoodies.com/imgs/question.png" alt="Question" /></h3>
<p>I have a MySQL (actually mariaDB) install that I just started replicating to another server.  I want to ensure that I&#8217;ve setup SSL correctly.  The SSL portion of <code>SHOW SLAVE STATUS</code> looks like:</p>
<pre class="prettyprint"><code>Master_SSL_Allowed: Yes
Master_SSL_CA_File: /etc/mysql/newcerts/ca-cert.pem
Master_SSL_CA_Path: /etc/mysql/newcerts/
Master_SSL_Cert: /etc/mysql/newcerts/client-cert.pem
Master_SSL_Cipher:
Master_SSL_Key: /etc/mysql/newcerts/client-key.pem
Seconds_Behind_Master: 0
Master_SSL_Verify_Server_Cert: No
</code></pre>
<p>Is this typical or show that replication is using SSL?  Is there something else I can check to ensure it&#8217;s using SSL?  The slave is successfully replicating.</p>
<div class="author">Asked by <a href="http://serverfault.com/users/120793/tubaguy50035" target="_blank">tubaguy50035</a></div>
<h3 class="pa"><img src="http://adminsgoodies.com/imgs/answer.png" alt="Answer" /></h3>
<p>Inspect the relevant traffic with tcpdump/wireshark.</p>
<div class="author">Answered by <a href="http://serverfault.com/users/120028/rackandboneman" target="_blank">rackandboneman</a></div>
<p class="ref-link">Check <a href="http://serverfault.com/questions/460044/how-to-check-if-mysql-replication-is-using-ssl" target="_blank">more discussion</a> of this question.</p>
]]></content:encoded>
			<wfw:commentRss>http://adminsgoodies.com/how-to-check-if-mysql-replication-is-using-ssl/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Installing mysqlnd for php 5.4.9 on CentOs 6.3</title>
		<link>http://adminsgoodies.com/installing-mysqlnd-for-php-5-4-9-on-centos-6-3/</link>
		<comments>http://adminsgoodies.com/installing-mysqlnd-for-php-5-4-9-on-centos-6-3/#comments</comments>
		<pubDate>Mon, 17 Dec 2012 17:36:30 +0000</pubDate>
		<dc:creator>tom</dc:creator>
				<category><![CDATA[General Questions]]></category>
		<category><![CDATA[centos]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[rpm]]></category>

		<guid isPermaLink="false">http://adminsgoodies.com/installing-mysqlnd-for-php-5-4-9-on-centos-6-3/</guid>
		<description><![CDATA[Okay let me get straight to the point, I am a complete noob, and have never done stuff like this at all, I have read tutorial after tuorial but I cant get anything to work. When I tried to install the rpm file I got this error rpm -Uvh ftp://ftp.pbone.net/mirror/rpms.famillecollet.com/enterprise/6/test/x86_64/php-mysqlnd-5.4.9-1.el6.remi.x86_64.rpm Retrieving ftp://ftp.pbone.net/mirror/rpms.famillecollet.com/enterprise/6/test/x86_64/php-mysqlnd-5.4.9-1.el6.remi.x86_64.rpm warning: /var/tmp/rpm-tmp.ez4vvd: Header V3 DSA/SHA1 Signature, key ID 00f97f56: NOKEY error: Failed dependencies: php-pdo(x86-64) = 5.4.9-1.el6.remi is needed by php-mysqlnd-5.4.9-1.el6.remi.x86_64 so I tried [...]]]></description>
				<content:encoded><![CDATA[<h3 class="pq"><img src="http://adminsgoodies.com/imgs/question.png" alt="Question" /></h3>
<p>Okay let me get straight to the point, I am a complete noob, and have never done stuff like this at all, I have read tutorial after tuorial but I cant get anything to work. When I tried to install the rpm file I got this error </p>
<pre class="prettyprint"><code>rpm -Uvh ftp://ftp.pbone.net/mirror/rpms.famillecollet.com/enterprise/6/test/x86_64/php-mysqlnd-5.4.9-1.el6.remi.x86_64.rpm
Retrieving ftp://ftp.pbone.net/mirror/rpms.famillecollet.com/enterprise/6/test/x86_64/php-mysqlnd-5.4.9-1.el6.remi.x86_64.rpm
warning: /var/tmp/rpm-tmp.ez4vvd: Header V3 DSA/SHA1 Signature, key ID 00f97f56: NOKEY
error: Failed dependencies:
        php-pdo(x86-64) = 5.4.9-1.el6.remi is needed by php-mysqlnd-5.4.9-1.el6.remi.x86_64
</code></pre>
<p>so I tried installing that rpm file and got this error </p>
<pre class="prettyprint"><code>rpm -ivh ftp://ftp.pbone.net/mirror/rrpms.famillecollet.com/enterprise/6/test/x86_64/php-pdo-5.4.6-1.el6.remi.x86_64.rpm
Retrieving ftp://ftp.pbone.net/mirror/rrpms.famillecollet.com/enterprise/6/test/x86_64/php-pdo-5.4.6-1.el6.remi.x86_64.rpm
curl: (9) Server denied you to change to the given directory
error: skipping ftp://ftp.pbone.net/mirror/rrpms.famillecollet.com/enterprise/6/test/x86_64/php-pdo-5.4.6-1.el6.remi.x86_64.rpm - transfer failed
</code></pre>
<p>I used the ftp links because I have no idea how else to get them to the server. I think I am getting overly frustrated with this, but I have to get this driver installed for any of my scripts to function correctly.</p>
<p>Any help would be greatly appreciated!</p>
<div class="author">Asked by <a href="http://serverfault.com/users/149852/kira423" target="_blank">kira423</a></div>
<h3 class="pa"><img src="http://adminsgoodies.com/imgs/answer.png" alt="Answer" /></h3>
<p>Try to add the Remi repository to <code>yum</code> and install it that way. Yum will automatically deal with all the dependencies for you, so you don&#8217;t have to follow the breadcrumb path all the way to the final dependency. Saves you lot of time and frustration <img src='http://adminsgoodies.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>As root user, run these commands:</p>
<pre class="prettyprint"><code>wget http://rpms.famillecollet.com/enterprise/remi.repo -O /etc/yum.repos.d/remi.repo
yum --enablerepo=remi-test install php-mysqlnd
</code></pre>
<p>The first command will retrieve the repository configuration file for Remi&#8217;s repo. The second command will install the <code>php-mysqlnd</code> package and will also use the Remi repo to install it.</p>
<div class="author">Answered by <a href="http://serverfault.com/users/26639/oldskool" target="_blank">Oldskool</a></div>
<p class="ref-link">Check <a href="http://serverfault.com/questions/458524/installing-mysqlnd-for-php-5-4-9-on-centos-6-3" target="_blank">more discussion</a> of this question.</p>
]]></content:encoded>
			<wfw:commentRss>http://adminsgoodies.com/installing-mysqlnd-for-php-5-4-9-on-centos-6-3/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
