<?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> &#187; mysql</title>
	<atom:link href="http://www.liguosong.com/category/mysql/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.liguosong.com</link>
	<description></description>
	<lastBuildDate>Tue, 08 May 2018 01:02:19 +0000</lastBuildDate>
	<language>zh-CN</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.2</generator>
		<item>
		<title>Warning: Using a password on the command line interface can be insecure.</title>
		<link>http://www.liguosong.com/2017/06/22/warning-using-a-password-on-the-command-line-interface-can-be-insecure/</link>
		<comments>http://www.liguosong.com/2017/06/22/warning-using-a-password-on-the-command-line-interface-can-be-insecure/#comments</comments>
		<pubDate>Thu, 22 Jun 2017 02:12:23 +0000</pubDate>
		<dc:creator>lgs</dc:creator>
				<category><![CDATA[mysql]]></category>

		<guid isPermaLink="false">http://www.liguosong.com/?p=621</guid>
		<description><![CDATA[mysql5.6版本在执行mysqldump自动化备份的时候，由于脚本是自动化运行，所以必须在shell中写入 [...]]]></description>
				<content:encoded><![CDATA[<p>mysql5.6版本在执行mysqldump自动化备份的时候，由于脚本是自动化运行，所以必须在shell中写入mysql用户的密码，但是执行之后，出现如下错误：</p>
<pre class="brush:bash">Warning: Using a password on the command line interface can be insecure.</pre>
<p>原因是5.6之后密码写在命令行不安全，解决方案是将用户名密码卸载配置文件中</p>
<pre class="brush:bash">vi /etc/my.cnf</pre>
<p>在my.cnf中增加如下代码</p>
<pre class="brush:bash">[mysqldump]
host=localhost
user=username
password='password'</pre>
<p>再次执行备份命令如下</p>
<pre class="brush:bash">mysqldump yourdatabase &gt; database.sql</pre>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.liguosong.com/2017/06/22/warning-using-a-password-on-the-command-line-interface-can-be-insecure/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>centos 7 install mysql 5.7</title>
		<link>http://www.liguosong.com/2016/11/12/centos-7-install-mysql-7/</link>
		<comments>http://www.liguosong.com/2016/11/12/centos-7-install-mysql-7/#comments</comments>
		<pubDate>Sat, 12 Nov 2016 15:25:52 +0000</pubDate>
		<dc:creator>lgs</dc:creator>
				<category><![CDATA[mysql]]></category>

		<guid isPermaLink="false">http://www.liguosong.com/?p=594</guid>
		<description><![CDATA[获取源 wget http://dev.mysql.com/get/mysql57-community-rel [...]]]></description>
				<content:encoded><![CDATA[<p>获取源</p>
<pre class="brush:bash">wget http://dev.mysql.com/get/mysql57-community-release-el7-7.noarch.rpm</pre>
<p>增加源</p>
<pre class="brush:bash">yum localinstall mysql57-community-release-el7-7.noarch.rpm</pre>
<p>安装mysql</p>
<pre class="brush:bash">yum install mysql-community-server</pre>
<p>启动数据库</p>
<pre class="brush:bash"> systemctl start  mysqld.service</pre>
<p>安装完了root密码在mysql的log中，进入到/var/log目录中</p>
<pre class="brush:bash">more mysqld.log | grep "temporary password is generated"</pre>
<p>这时候就会出现mysql root的初始密码了。。。记得更改一下</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.liguosong.com/2016/11/12/centos-7-install-mysql-7/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MySQL删除/更新数据时报1175错误</title>
		<link>http://www.liguosong.com/2015/07/01/mysql%e5%88%a0%e9%99%a4%e6%9b%b4%e6%96%b0%e6%95%b0%e6%8d%ae%e6%97%b6%e6%8a%a51175%e9%94%99%e8%af%af/</link>
		<comments>http://www.liguosong.com/2015/07/01/mysql%e5%88%a0%e9%99%a4%e6%9b%b4%e6%96%b0%e6%95%b0%e6%8d%ae%e6%97%b6%e6%8a%a51175%e9%94%99%e8%af%af/#comments</comments>
		<pubDate>Wed, 01 Jul 2015 02:47:06 +0000</pubDate>
		<dc:creator>lgs</dc:creator>
				<category><![CDATA[mysql]]></category>

		<guid isPermaLink="false">http://www.liguosong.com/?p=503</guid>
		<description><![CDATA[今天删除数据的时候，报了如下错误： Error Code:1175.You are using safe up [...]]]></description>
				<content:encoded><![CDATA[<p>今天删除数据的时候，报了如下错误：</p>
<pre class="brush:sql">Error Code:1175.You are using safe update mode and you tried to update a table without a WHERE that uses a key column To disable safe mode, toggle the option in Preferences -&gt; SQL Queries and reconnect.</pre>
<p>后来查了资料，发现mysql有SQL_SAFE_UPDATES的变量，这是为了数据库操作的安全。此值默认设置为1，所以才会出现更新失败的情况。</p>
<p>下面是SQL_SAFE_UPDATES变量为0和1时的取值说明：</p>
<p>SQL_SAFE_UPDATES有两个取值0和1，</p>
<p>SQL_SAFE_UPDATES = 1时，不带where和limit条件的update和delete操作语句是无法执行的，即使是有where和limit条件但不带key column的update和delete也不能执行。</p>
<p>SQL_SAFE_UPDATES = 0时，update和delete操作将会顺利执行。</p>
<p>所以，出现1175错误的时候，可以先设置SQL_SAFE_UPDATES的值为0或者使用主键作为where条件删除或者更新。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.liguosong.com/2015/07/01/mysql%e5%88%a0%e9%99%a4%e6%9b%b4%e6%96%b0%e6%95%b0%e6%8d%ae%e6%97%b6%e6%8a%a51175%e9%94%99%e8%af%af/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Change the MySql data default directory</title>
		<link>http://www.liguosong.com/2014/05/04/change-mysql-data-default-directory/</link>
		<comments>http://www.liguosong.com/2014/05/04/change-mysql-data-default-directory/#comments</comments>
		<pubDate>Sun, 04 May 2014 08:59:26 +0000</pubDate>
		<dc:creator>lgs</dc:creator>
				<category><![CDATA[mysql]]></category>
		<category><![CDATA[mysql 更改数据库文件位置]]></category>

		<guid isPermaLink="false">http://www.liguosong.com/?p=266</guid>
		<description><![CDATA[注意：在操作之前，要先备份好数据库。 默认情况下，MySql的数据库文件位于/var/lib/mysql下。于 [...]]]></description>
				<content:encoded><![CDATA[<p><span style="color: #ff0000;">注意：在操作之前，要先备份好数据库。</span><br />
默认情况下，MySql的数据库文件位于/var/lib/mysql下。于是想着把现在的数据库文件移动到挂载的硬盘上。找了一些办法，例如一起移动socket，datadir等等。但是移动完成后不能启动。最终找到了一个很完美的方案。<span id="more-266"></span></p>
<ul>
<li><span style="line-height: 1.714285714; font-size: 1rem;"><span style="line-height: 1.714285714; font-size: 1rem;">停止Mysql服务<br />
</span></span></p>
<pre class="brush:ps">sudo /etc/init.d/mysql stop</pre>
</li>
<li><span style="line-height: 1.714285714; font-size: 1rem;"><span style="line-height: 1.714285714; font-size: 1rem;">复制现在的数据库文件到新的路径下<br />
</span></span></p>
<pre class="brush:ps">sudo cp -R -p /var/lib/mysql /path/to/new/datadir</pre>
</li>
<li><span style="line-height: 1.714285714; font-size: 1rem;">更改MySql的配置文件.在my.cnf中查找datadir，将其值更改为新的路径。</span></li>
<li><span style="line-height: 1.714285714; font-size: 1rem;"><span style="line-height: 1.714285714; font-size: 1rem;">修改usr.sbin.mysqld。如不明白为什么修改这个文件，查看一下AppArmor</span></span>
<pre class="brush:ps">sudo vi /etc/apparmor.d/usr.sbin.mysqld</pre>
<p>从/var/lib/mysql到最后，先复制一下。然后将原来的值全部用#注释掉。如果有注释的，最好也加一个注释，这样就会知道哪些注释是默认的，哪些注释是你新添加的。注释完后，在最后一行粘贴刚才复制的内容。并将/var/lib/mysql的值换成新的路径</li>
<li><span style="line-height: 1.714285714; font-size: 1rem;"><span style="line-height: 1.714285714; font-size: 1rem;">启动MySql</span></span>
<pre class="brush:ps">sudo service mysql start</pre>
</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.liguosong.com/2014/05/04/change-mysql-data-default-directory/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
