<?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>MySQL &#8211; Hostry Help Center</title>
	<atom:link href="https://help.hostry.com/article-tags/mysql/feed/" rel="self" type="application/rss+xml" />
	<link>https://help.hostry.com</link>
	<description>Full information on how to use HOSTRY, provided by 24/7 community based support</description>
	<lastBuildDate>Tue, 14 Jun 2022 04:57:17 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=5.9.12</generator>

<image>
	<url>https://help.hostry.com/wp-content/uploads/cache/2021/01/cropped-apple-icon-180x180-1/836712163.png</url>
	<title>MySQL &#8211; Hostry Help Center</title>
	<link>https://help.hostry.com</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>Converting from MySQL to MariaDB on Ubuntu</title>
		<link>https://help.hostry.com/knowledge-base/converting-from-mysql-to-mariadb-to-ubuntu/</link>
		
		<dc:creator><![CDATA[Alex]]></dc:creator>
		<pubDate>Thu, 13 Feb 2020 10:27:18 +0000</pubDate>
				<guid isPermaLink="false">https://help.hostry.com/?post_type=ht_kb&#038;p=1405</guid>

					<description><![CDATA[This guide will describe the steps for converting a MySQL server to a MariaDB server and resolving unsatisfied dependencies that may arise during the conversion process. This manual is intended only for virtual servers on which the Ubuntu operating system is installed. Uninstall MySQL server To get started, run these [&#8230;]]]></description>
										<content:encoded><![CDATA[
<p>This guide will describe the steps for converting a MySQL server to a MariaDB server and resolving unsatisfied dependencies that may arise during the conversion process. This manual is intended only for virtual servers on which the Ubuntu operating system is installed. </p>



<h2 id="uninstall-mysql-server" >Uninstall MySQL server </h2>



<p>To get started, run these commands as root or use sudo</p>



<pre class="wp-block-code"><code>
service mysql stop
apt-get remove mysql-server mysql-common libmysqlclient18</code></pre>



<h2 id="install-mariadb" >Install MariaDB </h2>



<p>Run the following command </p>



<pre class="wp-block-code"><code>apt-get install software-properties-common</code></pre>



<p>Add MariaDB Store Key </p>



<pre class="wp-block-code"><code>sudo apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xcbcb082a1bb943db</code></pre>



<p>Add MariaDB Repository </p>



<pre class="wp-block-code"><code>sudo add-apt-repository 'deb http://ftp.utexas.edu/mariadb/repo/10.0/ubuntu trusty main'</code></pre>



<p>Install MariaDB </p>



<pre class="wp-block-code"><code>apt-get install mariadb-server libmariadbclient18</code></pre>



<p>Handling Unsatisfied Dependencies </p>



<p>The MariaDB installer may fail (which often happens) with an error, such as this one: </p>



<pre class="wp-block-code"><code>mariadb-server : Depends: mariadb-server-10.0 (specific version) but it is not going to be installed.</code></pre>



<p>This can be frustrating and may not look right. Next, you need to install all the adjacent dependencies. Add g ++ repository to server to resolve libstdc ++ 6 dependency. </p>



<h2 id="add-g" >Add g ++ </h2>



<pre class="wp-block-code"><code>add-apt-repository ppa:ubuntu-toolchain-r/test
apt-get update
apt-get install g++-4.9</code></pre>



<p>Pin the MariaDB repository</p>



<p>This is done by creating a file with <strong>MariaDB.pref</strong> in <strong>/etc/apt/preferences.d/</strong> with the contents shown below:</p>



<p></p>



<pre class="wp-block-code"><code>Package: *
Pin: origin &lt;mirror-domain>
Pin-Priority: 1000</code></pre>



<p>Replace the <strong><em>&lt;mirror-domain&gt; </em></strong>that is displayed when accessing the MarizDB repository selection page</p>



<p>In my case, I chose the <strong>&#8220;University of Dallas&#8221;</strong>. After updating, the file now has the following contents:</p>



<pre class="wp-block-code"><code>Package: *
Pin: origin http://ftp.udallas.edu/mariadb/repo/10.0/ubuntu
Pin-Priority: 1000</code></pre>



<p>Save the file, upgrade your system.</p>



<pre class="wp-block-code"><code>apt-get update</code></pre>



<p>Now, dependency problems have been resolved. If you use 12.04, then pay attention to the fact (it is important) that there were reports that g ++ was excluded from this version.</p>



<p>Install MariaDB again</p>



<pre class="wp-block-code"><code>apt-get install mariadb-server</code></pre>



<p>Check your installation of MariaDB</p>



<pre class="wp-block-code"><code>service mysql start
mysql -u root -p</code></pre>



<p>Now, you can see the following (or the same) output</p>



<pre class="wp-block-code"><code>Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is XXXX
Server version: 10.0.X


Copyright (c) 2000, 2014, Oracle, Monty Program Ab and others.


Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]></code></pre>



<p></p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>How Can I use Substring function in MySQL data</title>
		<link>https://help.hostry.com/knowledge-base/how-can-i-use-substring-function-in-mysql-data/</link>
					<comments>https://help.hostry.com/knowledge-base/how-can-i-use-substring-function-in-mysql-data/#respond</comments>
		
		<dc:creator><![CDATA[Alex]]></dc:creator>
		<pubDate>Mon, 06 Dec 2021 09:31:15 +0000</pubDate>
				<guid isPermaLink="false">https://help.hostry.com/?post_type=ht_kb&#038;p=4457</guid>

					<description><![CDATA[Mysql database has many built-in functions. They are available for completely different purposes, one of which is the Substring function. This function actively works with the &#8220;row&#8221; data type and is used in database management to retrieve rows from tables. What is this line? A string is an aggregate combination [&#8230;]]]></description>
										<content:encoded><![CDATA[
<p>Mysql database has many built-in functions. They are available for completely different purposes, one of which is the Substring function. This function actively works with the &#8220;row&#8221; data type and is used in database management to retrieve rows from tables. What is this line? A string is an aggregate combination of characters. For example, <strong>&#8220;Hello_World_from here&#8221;</strong> and <strong>&#8220;test345&#8221;</strong> are strings.</p>



<p>Substring is a special function that is used to return or extract a string from strings in any table. The general syntax looks like this:</p>



<pre class="wp-block-code"><code>SUBSTRING(string, start, length)</code></pre>



<p>In order for you to understand this function, you can take a table as an example and use the following commands to extract rows from it. We will open a terminal and type &#8220;mysql&#8221; to enter the MySQL environment.</p>



<pre class="wp-block-code"><code>sudo mysql</code></pre>



<p>Next, you should open the list of databases, all that you currently have in MySQL</p>



<pre class="wp-block-code"><code>show DATABASES;</code></pre>



<p>Next, you should open a database, for example with the name &#8220;sample database&#8221;:</p>



<pre class="wp-block-code"><code>SHOW TABLES;</code></pre>



<p>In the output, we can see that the company database contains only one table named &#8220;<strong><strong>Hello_World_from_here</strong></strong>&#8220;. We will now access this table to display its contents:</p>



<pre class="wp-block-code"><code>DESCRIBE Hello_World_from_here</code></pre>



<p>We can now display the contents of the table:</p>



<pre class="wp-block-code"><code>SELECT * FROM Hello_World_from_here</code></pre>



<p>We say that we want to extract the string <strong>&#8220;Hello&#8221;</strong> from the table using the Substring function, then we will use the code according to the syntax we discussed above, and we will use <strong>&#8220;AS ExtractString&#8221;</strong> to return a value in the form of a string from the table …</p>



<pre class="wp-block-code"><code>SELECT SUBSTRING(employee_name, 1, 5) AS ExtractString FROM Hello_World_from_here;</code></pre>



<p>This command is used as a terminal. This is necessary in order to fetch a row from a column named employee_name, start at the first character, and extract the next 5 characters. To understand this better, let&#8217;s say we want to extract 2 characters from the column named <strong>World_from_here</strong>, but it starts at the third character, so the command will be.</p>



<pre class="wp-block-code"><code>SELECT SUBSTRING(World_from_here, 1, 5) AS ExtractString FROM Hello_World_from_here;\</code></pre>



<p>This output will deal with extracting only &#8220;dr&#8221; and &#8220;xi&#8221;. In addition, a command will be run to retrieve the string.</p>



<pre class="wp-block-code"><code>SELECT SUBSTRING(“Hello”, +3, 2) AS World_from_here;</code></pre>



<p>So, what happened in the latest changes.</p>



<p>The terminal was requested to use a special MySQL function that returns string characters from the string &#8220;World&#8221; and starts at its third position from the start point, the + ve sign tells it to start at the start point and extract the next two characters. So, in the line &#8220;World&#8221;, if we start at the third position from the starting point, it will start with &#8220;d&#8221;, and if we extract two characters next to it, then it will be &#8220;dr&#8221;</p>



<p>Now, at the moment, you need to run the following command. This will now allow you to extract &#8220;ax&#8221; from the string &#8220;Maxim&#8221; using a starting point at the end of the string.</p>



<pre class="wp-block-code"><code>SELECT SUBSTRING(“Maxim”, -4, 2) AS World_from_here;</code></pre>
]]></content:encoded>
					
					<wfw:commentRss>https://help.hostry.com/knowledge-base/how-can-i-use-substring-function-in-mysql-data/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>How to back up MySQL databases</title>
		<link>https://help.hostry.com/knowledge-base/how-to-back-up-mysql-databases/</link>
					<comments>https://help.hostry.com/knowledge-base/how-to-back-up-mysql-databases/#comments</comments>
		
		<dc:creator><![CDATA[Alex]]></dc:creator>
		<pubDate>Mon, 10 Feb 2020 09:15:12 +0000</pubDate>
				<guid isPermaLink="false">https://help.hostry.com/?post_type=ht_kb&#038;p=1395</guid>

					<description><![CDATA[MySQL is the software that is the most popular in the world that is used for databases. It is very important to make sure that you have backups. The causes of data loss can be very diverse: hardware failure, software changes, and much more. You can always restore your entire [&#8230;]]]></description>
										<content:encoded><![CDATA[
<p><strong><em><a href="https://www.mysql.com/">MySQL</a></em></strong> is the software that is the most popular in the world that is used for databases. It is very important to make sure that you have <em><a href="https://hostry.com/blog/the-crucial-importance-of-backup/">backups</a></em>. The causes of data loss can be very diverse: hardware failure, software changes, and much more. You can always restore your entire database using backups.</p>



<p>The syntax for using the nysqldump command to export a database is. This shows us the following: </p>



<blockquote class="wp-block-quote"><p><strong>Access to the username database; </strong></p><p><strong>Mysqldump may ask you for a password; </strong></p><p><strong>Following are the processes that will tell us about backing up databases to an SQL file named name.sq</strong></p></blockquote>



<h2 id="restore-your-database" >Restore your database </h2>



<p><strong><em>Primarily!</em></strong> If something went wrong for you, you can easily restore your database. Log in to get started </p>



<pre class="wp-block-code"><code>mysql -u username -p</code></pre>



<p>Then create a new database</p>



<pre class="wp-block-code"><code>CREATE DATABASE newdb;</code></pre>



<p>Quit MySQL </p>



<pre class="wp-block-code"><code>exit</code></pre>



<p>After that, you can import the SQL file into a new database</p>



<pre class="wp-block-code"><code>mysql -u username -p newdb &lt; name.sql</code></pre>



<p>This completes the process of importing your <strong>SQL</strong> file into a new database!</p>
]]></content:encoded>
					
					<wfw:commentRss>https://help.hostry.com/knowledge-base/how-to-back-up-mysql-databases/feed/</wfw:commentRss>
			<slash:comments>11332</slash:comments>
		
		
			</item>
		<item>
		<title>How To Backup, Restore or Transfer MySQL/MariaDB Databases on Ubuntu</title>
		<link>https://help.hostry.com/knowledge-base/how-to-backup-restore-or-transfer-mysql-mariadb-databases-on-ubuntu/</link>
					<comments>https://help.hostry.com/knowledge-base/how-to-backup-restore-or-transfer-mysql-mariadb-databases-on-ubuntu/#comments</comments>
		
		<dc:creator><![CDATA[Alex]]></dc:creator>
		<pubDate>Fri, 18 Oct 2019 06:27:04 +0000</pubDate>
				<guid isPermaLink="false">https://help.hostry.com/?post_type=ht_kb&#038;p=816</guid>

					<description><![CDATA[Today, Backup is a significant procedure and a very important part of working with databases. Regardless of whether you use a corporate website or just host WordPress, it is important to back up your databases. The backup storage is necessary in order to be able to restore information in a [&#8230;]]]></description>
										<content:encoded><![CDATA[
<p>Today, <strong><em><a href="https://hostry.com/blog/the-crucial-importance-of-backup/">Backup</a></em></strong> is a significant procedure and a very important part of working with databases. Regardless of whether you use a corporate website or just host WordPress, it is important to back up your databases. The backup storage is necessary in order to be able to restore information in a very quick and convenient way, in the event that a working copy of the information may be lost for any reason: restoration of documents, settings, certain programs and other things.</p>



<h2 id="backup-process" >Backup process</h2>



<p>We recommend a way to back up a MySQL or MariaDB database using the <strong>mysqldump </strong>dump command. </p>



<pre class="wp-block-code"><code>echo "SHOW DATABASES;" | sudo mysql</code></pre>



<p>This command displays a list of your databases. Make sure you know which .sql file you need, and then simply run the following command to backup to the file.</p>



<pre class="wp-block-code"><code>sudo mysqldump example_database > $(date +"%F").sql</code></pre>



<p>The command described above will back up the example_database to a file with a date ending in .sql. It is also possible to change the name of this file to any other, although saving the file name as a date will be useful if you accidentally delete an important row or column. Use date &#8211;help to learn about other ways to style your date.</p>



<h2 id="recovery" >Recovery</h2>



<p>Here you need to find the .sql file that you created and run the following:</p>



<pre class="wp-block-code"><code>sudo mysql example_database &lt; filename.sql</code></pre>



<h2 id="migrating-to-mariadb-from-mysql" >Migrating to MariaDB from MySQL</h2>



<p>The first thing to do is back up each of your databases:</p>



<pre class="wp-block-code"><code>sudo mysqldump example_database > example_database.sql</code></pre>



<p>After that, you will need to install MariaDB, which will replace MySQL, and restore your databases by following these steps for each database.</p>



<pre class="wp-block-code"><code>sudo mysql example_database &lt; example_database.sql</code></pre>



<p></p>
]]></content:encoded>
					
					<wfw:commentRss>https://help.hostry.com/knowledge-base/how-to-backup-restore-or-transfer-mysql-mariadb-databases-on-ubuntu/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
			</item>
		<item>
		<title>How To Drop a Database on MySQL</title>
		<link>https://help.hostry.com/knowledge-base/how-to-drop-a-database-on-mysql/</link>
					<comments>https://help.hostry.com/knowledge-base/how-to-drop-a-database-on-mysql/#respond</comments>
		
		<dc:creator><![CDATA[Alex]]></dc:creator>
		<pubDate>Tue, 29 Dec 2020 09:08:43 +0000</pubDate>
				<guid isPermaLink="false">https://help.hostry.com/?post_type=ht_kb&#038;p=2899</guid>

					<description><![CDATA[MySQL is a Relational Database Management System that is known for being very easy to use, nice interface, and also fast. In this article, we will take a look at such database management techniques as deleting a database in MySQL. To get started with MySQL, open a terminal. First, check [&#8230;]]]></description>
										<content:encoded><![CDATA[
<p><a href="https://www.mysql.com/"><strong>MySQL</strong></a> is a Relational Database Management System that is known for being very easy to use, nice interface, and also fast. In this article, we will take a look at such database management techniques as deleting a database in MySQL. To get started with <strong>MySQL</strong>, open a terminal. First, check your <a href="https://en.wikipedia.org/wiki/MySQL"><strong>MySQL</strong></a> version with the following command:</p>



<pre class="wp-block-code"><code>mysql - V</code></pre>



<p>Check for the latest up-to-date database version. If it is, then proceed to the step of checking the status of the system mysql.service. To do this, run the following command:</p>



<pre class="wp-block-code"><code>sudo systemctl status mysql</code></pre>



<p>If the service is not active, start the service</p>



<pre class="wp-block-code"><code>sudo systemctl start mysql</code></pre>



<p>After starting the service, connect to the MySQL client or log into the MySQL shell as the root user. If you do not have access to the root user account, replace <strong>“root”</strong> with your username</p>



<pre class="wp-block-code"><code>sudo mysql -u root -p</code></pre>



<p>After logging into MySQL, list the databases with SHOW DATABASES command:</p>



<pre class="wp-block-code"><code>SHOWDATABASES;</code></pre>



<p>After you have a list of databases, then you need to select the database in which you want to delete. If you want to drop an existing database, you can run a simple <strong>DROP DATABASE</strong> command along with the database name like this:</p>



<pre class="wp-block-code"><code>DROPDATABASE your_database_name;</code></pre>



<p>After deleting the database, you need to list the databases again, for this use the <strong>SHOW DATABASES</strong> command</p>



<pre class="wp-block-code"><code>SHOWDATABASES;</code></pre>



<p>Now it is possible to notice that the remote database no longer exists in MySQL.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://help.hostry.com/knowledge-base/how-to-drop-a-database-on-mysql/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>How To Enable The General MySQL Query Log on Linux</title>
		<link>https://help.hostry.com/knowledge-base/how-to-enable-the-general-mysql-query-log-on-linux/</link>
					<comments>https://help.hostry.com/knowledge-base/how-to-enable-the-general-mysql-query-log-on-linux/#respond</comments>
		
		<dc:creator><![CDATA[Alex]]></dc:creator>
		<pubDate>Tue, 28 Apr 2020 09:58:37 +0000</pubDate>
				<guid isPermaLink="false">https://help.hostry.com/?post_type=ht_kb&#038;p=1653</guid>

					<description><![CDATA[There are two potential possibilities to accomplish this: 1. Add to my.cnf file permanently or 2. include general queries for MySQL on versions higher than 5.1.29 1. Add to my.cnf file forever vim /etc/my.cnf log = /home/general-query.log Install via MySQL Console SET general_log = 1; Start server systemctl restart mysqld [&#8230;]]]></description>
										<content:encoded><![CDATA[
<p>There are two potential possibilities to accomplish this: 1. Add to my.cnf file permanently or 2. include general queries for MySQL on versions higher than 5.1.29 </p>



<h2 id="1-add-to-my-cnf-file-forever" >1. Add to my.cnf file forever</h2>



<pre class="wp-block-preformatted">vim /etc/my.cnf 
log = /home/general-query.log</pre>



<p>Install via MySQL Console</p>



<pre class="wp-block-preformatted">SET general_log = 1;</pre>



<p>Start server</p>



<pre class="wp-block-preformatted">systemctl restart mysqld</pre>



<h2 id="2-add-to-my-cnf-file-permanently-or-include-general-queries-for-mysql-on-versions-higher-than-5-1-29" >2. Add to my.cnf file permanently or include general queries for MySQL on versions higher than 5.1.29</h2>



<pre class="wp-block-preformatted">general_log_file = /path/to/general-query.log

general_log = 1</pre>



<p>Install via MySQL Console</p>



<pre class="wp-block-preformatted">SET general_query_log = 1;</pre>



<p>Then create the general-query.log file in which you want to store these logs</p>



<pre class="wp-block-preformatted">touch general-query.log

chown -R mysql:mysql general-query.log

systemctl restart mysqld</pre>



<p>Done! You have now successfully enabled the general MySQL query log on Linux. </p>



<p></p>
]]></content:encoded>
					
					<wfw:commentRss>https://help.hostry.com/knowledge-base/how-to-enable-the-general-mysql-query-log-on-linux/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>How To Install And Configure MySQL For Debian</title>
		<link>https://help.hostry.com/knowledge-base/how-to-install-mysql/</link>
					<comments>https://help.hostry.com/knowledge-base/how-to-install-mysql/#comments</comments>
		
		<dc:creator><![CDATA[Paul Harris]]></dc:creator>
		<pubDate>Mon, 29 Jul 2019 07:16:12 +0000</pubDate>
				<guid isPermaLink="false">https://help.hostry.com/?post_type=ht_kb&#038;p=423</guid>

					<description><![CDATA[For Debian-based distributions First, update the apt package index with the command: sudo apt update Then install the package: sudo apt install mysql-server This command will install MySQL, then basic MySQL configuration is required Configure MySQL Run the security script with: sudo mysql_secure_installation As you can see, security is at [&#8230;]]]></description>
										<content:encoded><![CDATA[
<h2 id="for-debian-based-distributions" >For Debian-based distributions</h2>



<p>First, update the apt package index with the command:</p>



<p><code>sudo apt update</code></p>



<p>Then<strong> install the package</strong>:</p>



<p><code>sudo apt install mysql-server</code></p>



<p>This command will install MySQL, then basic MySQL configuration is required</p>



<p></p>



<h2 id="configure-mysql" >Configure MySQL</h2>



<p>Run the security script with:</p>



<p><code>sudo mysql_secure_installation</code></p>



<p>As you can see, security is at the plinth level. At least there is no anonymous user. To configure the basic things in the server, run the server configuration through mysql_secure_installation. At the time of this installation, the password will be security. Your same password, as you know, should be different</p>



<p><code>/usr/bin/mysql_secure_installation</code></p>



<p>Skip root <strong>password</strong> for root</p>



<p>We haven&#8217;t set the root password yet, so when you run the script and ask for the root password, just press Enter. Install new password for root: security, and here you can set the password for root. Do remove an anonymous user. When asked whether to remove an anonymous user, answer <strong>Yes</strong></p>



<p>Do not disallow remote connections. Do not prohibit the connection to our North from remote servers (if, of course, this option you need, in other case, prohibit it). Do remove a test database. Test base we do not need &#8211; remove it. Do reload the privileges. Overload privileges to activate them</p>



<p>The password is now set for all root users. If you did not set a root password during this configuration, you can do so as follows:</p>



<p><code>SET PASSWORD FOR 'root'@'localhost' = PASSWORD('security');</code></p>



<p><code>SET PASSWORD FOR 'root'@'localhost.localdomain' = PASSWORD('security');</code></p>



<p><code>SET PASSWORD FOR 'root'@'127.0.0.1' = PASSWORD('security');</code></p>



<p>or</p>



<p><code>UPDATE mysql.user SET Password = PASSWORD('security') WHERE user = 'root';</code></p>



<p>If <strong>you did not run the configuration through mysql_secure_installation </strong>or do not want to do so for some other reason, the following commands will remove any users:</p>



<p><code>DROP USER "@'localhost';</code></p>



<p><code>DROP USER "@'localhost.localdomain';</code></p>



<p>Also, the password for IPv6 localhost (@::1) can be set this way:</p>



<p><code>SET PASSWORD FOR 'root'@'::1' = PASSWORD(&lt;password&gt;);</code></p>



<p>The final of our action is coming. There are two things. Open the ports for mysql:</p>



<p><code>sudo iptables -I INPUT -p tcp --dport 3306 -m state --state NEW,ESTABLISHED -j ACCEPT</code></p>



<p><code>sudo iptables -I OUTPUT -p tcp --sport 3306 -m state --state ESTABLISHED -j ACCEPT</code></p>



<p>Set the default UTF-8 encoding to <strong>/etc/my.cnf</strong></p>



<p><code>[mysqld]</code></p>



<p><code>init_connect=‘SET collation_connection = utf8_unicode_ci’</code></p>



<p><code>character-set-server = utf8</code></p>



<p><code>collation-server = utf8_unicode_ci</code></p>



<p><code>[client]</code></p>



<p><code>default-character-set = utf8</code></p>



<p>Overloading the service:</p>



<p><code>sudo service mysqld restart</code></p>



<p><strong><em>Conclusion</em></strong></p>



<p><code>mysqld: can't create directory '/var/lib/mysql/' (Errcode: 17 - File exists)</code></p>



<p><code>. . .</code></p>



<p><code>2019-07-15T14:30:25.572066 Z 0 [ERROR] Abortion</code></p>



<p>Note that although you have set a password for The MySQL root user, this user is not configured for password authentication when connecting to the MySQL shell. </p>



<p>Check if the service started:</p>



<p><code>systemctl status mysql.service</code></p>



<blockquote class="wp-block-quote"><p>mysql.service &#8211; MySQL Community Server</p><p>Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: en</p><p>Active: active (running) since Mon 2019-07-15 14:30:25 UTC; 30min ago</p><p>Main PID: 3754 (mysqld)</p><p>Tasks: 28</p><p>Memory: 149.3 M</p><p>CPU: 2.094 s</p><p>CGroup: /system.slice/mysql.service</p><p>7875 /usr/sbin/mysqld</p></blockquote>



<h2 id="optional-configure-authentication-and-privileges" >Optional configure authentication and privileges</h2>



<p>On
servers running Ubuntu that use MySQL 5.7 (and later), the MySQL root
user is authenticated by default using the auth_socket plugin, not by
password. This is generally more secure and convenient in many cases,
but not when you need to organize access to MySQL from a third-party
program, for example, phpMyAdmin.</p>



<p>In order for the MySQL root user to be able to use the login password, you need to change the authentication method from auth_socket to mysql_native_password. To do this, enter the MySQL shell with the following command:</p>



<p><code>sudo mysql</code></p>



<p>Next, check which authentication method is used for each of your MySQL users. SELECT user,host,authentication_string,plugin FROM mysql.user. Like this you can see</p>



<p><code>+------------------+-----------+-------------------------------------------+-----------------------+</code></p>



<p><code>| user | host | authentication_string | plugin |</code></p>



<p><code>+------------------+-----------+-------------------------------------------+-----------------------+</code></p>



<p><code>| root | localhost | | auth_socket |</code></p>



<p><code>| mysql.session | localhost | *THISISNOTAVALIDPASSWORDTHATCANBEUSEDHERE | mysql_native_password |</code></p>



<p><code>| mysql.sys | localhost | *THISISNOTAVALIDPASSWORDTHATCANBEUSEDHERE | mysql_native_password |</code></p>



<p><code>| debian-sys-maint | localhost | *CC744277A401A7D25BE1CA89AFF17BF607F876FF | mysql_native_password |</code></p>



<p><code>+------------------+-------------------------------------------+-----------------------+-----------+</code></p>



<p><code>4 rows in set (0.00 sec)</code></p>



<p>The string auth_socket means that the user will be able to connect without entering a password when connecting via a local UNUX socket. If you are not satisfied with this behavior of MySQL, enter the following command in the mysql console. </p>



<p><code>&gt; ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'VERY_VERY_SECURE_PASSWORD';</code></p>



<p>Naturally VERY_VERY_SECURE_PASSWORD replace really safe, known only to those who should know it</p>



<p><code>&gt; FLUSH PRIVILEGES;</code></p>



<p>Check yourself! SELECT user,host,authentication_string,plugin FROM mysql.user. Like this you can see</p>



<p><code>+------------------+-----------+-------------------------------------------+-----------------------+</code></p>



<p><code>| user | host | authentication_string | plugin |</code></p>



<p><code>+------------------+-----------+-------------------------------------------+-----------------------+</code></p>



<p><code>| root | localhost | *8C744276549879874FC098CABFF17BF607F876FF | mysql_native_password |</code></p>



<p><code>| mysql.session | localhost | *THISISNOTAVALIDPASSWORDTHATCANBEUSEDHERE | mysql_native_password |</code></p>



<p><code>| mysql.sys | localhost | *THISISNOTAVALIDPASSWORDTHATCANBEUSEDHERE | mysql_native_password |</code></p>



<p><code>| debian-sys-maint | localhost | *CC744277A401A7D25BE1CA89AFF17BF607F876FF | mysql_native_password |</code></p>



<p><code>+------------------+-------------------------------------------+-----------------------+-----------+</code></p>



<p><code>4 rows in set (0.00 sec)</code></p>



<p><strong>For verification</strong>:</p>



<ul><li><strong>Exit the mysql client (ctrl+d or write exit) if you are in it;</strong></li><li><strong>As root, type mysql or (sudo mysql) as another user.</strong></li></ul>



<p>Mysql program should ask for a password if you log in without a password recheck the steps. Add a local tommy superuser with full database access and the right to assign rights to other users:</p>



<p><code>&gt; GRANT ALL PRIVILEGES ON *.* TO 'tommy'@'localhost' WITH GRANT OPTION IDENTIFIED BY 'VERY_SECURE_TOO_PASSWORD';</code></p>



<p>Adding user jonny connecting with IP 123.45.67.89 to work with WORDPRESS database:</p>



<p><code>&gt; GRANT ALL PRIVILEGES ON *.WORDPRESS TO 'tommy'@'123.45.67.89' IDENTIFIED BY 'OTHER_VERY_SECURE_PASSWORD';</code></p>



<p></p>
]]></content:encoded>
					
					<wfw:commentRss>https://help.hostry.com/knowledge-base/how-to-install-mysql/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
			</item>
		<item>
		<title>How to install Apache, MySQL and PHP on Ubuntu 18.04</title>
		<link>https://help.hostry.com/knowledge-base/how-to-install-apache-mysql-and-php-on-ubuntu-18-04/</link>
					<comments>https://help.hostry.com/knowledge-base/how-to-install-apache-mysql-and-php-on-ubuntu-18-04/#comments</comments>
		
		<dc:creator><![CDATA[Alex]]></dc:creator>
		<pubDate>Fri, 22 Nov 2019 14:09:26 +0000</pubDate>
				<guid isPermaLink="false">https://help.hostry.com/?post_type=ht_kb&#038;p=918</guid>

					<description><![CDATA[Ubuntu is one of the most popular Linux distributions. A lot of users use it to work with vps. To install LAMP (Apache, MySQL, PHP) you need a server with sudo access for commands. Apache installation First of all (as with any other installation of programs), you need to update [&#8230;]]]></description>
										<content:encoded><![CDATA[
<p>Ubuntu is one of the most popular Linux distributions. A lot of users use it to work with vps. To install LAMP (Apache, MySQL, PHP) you need a server with sudo access for commands.</p>



<h2 id="apache-installation" >Apache installation </h2>



<p>First of all (as with any other installation of programs), you need to update the package manager</p>



<pre class="wp-block-code"><code>sudo apt-get update -y</code></pre>



<p>Install and start Apache</p>



<pre class="wp-block-code"><code>sudo apt-get install apache2 -y
sudo systemctl start apache2.service</code></pre>



<p>It is important to make sure that Apache was installed correctly and without errors. To do this, enter hostname -I in order to get your IP address and go to the link http:// SERVER_IP/</p>



<h2 id="mysql-installation" >MySQL installation</h2>



<pre class="wp-block-code"><code>sudo apt-get install mysql-server -y</code></pre>



<p>This command will install the MariaBD database server and will then be prompted to enter the password for the root MySQL user. This step is required.</p>



<h2 id="install-php" >Install PHP</h2>



<p>You can install PHP using the following command:</p>



<pre class="wp-block-code"><code>sudo apt-get install php -y</code></pre>



<p>After installing PHP, you need to install common PHP extensions, such as GD, MySQL, and so on, using the following command:</p>



<pre class="wp-block-code"><code>sudo apt-get install -y php-{bcmath,bz2,intl,gd,mbstring,mcrypt,mysql,zip} &amp;&amp; sudo apt-get install libapache2-mod-php  -y</code></pre>



<h2 id="automatically-starting-apache-and-mysql-on-boot" >Automatically Starting Apache and MySQL on Boot</h2>



<p>These commands will allow you to start Apache and MySQL always when loading your web environment</p>



<pre class="wp-block-code"><code>sudo systemctl enable apache2.service
sudo systemctl enable mysql.service</code></pre>



<p>Next, restart the Apache server for PHP to work</p>



<pre class="wp-block-code"><code>systemctl restart apache2.service</code></pre>
]]></content:encoded>
					
					<wfw:commentRss>https://help.hostry.com/knowledge-base/how-to-install-apache-mysql-and-php-on-ubuntu-18-04/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
			</item>
		<item>
		<title>How to install MySQL Workbench on Debian 11</title>
		<link>https://help.hostry.com/knowledge-base/how-to-install-mysql-workbench-on-debian-11/</link>
					<comments>https://help.hostry.com/knowledge-base/how-to-install-mysql-workbench-on-debian-11/#respond</comments>
		
		<dc:creator><![CDATA[Alex]]></dc:creator>
		<pubDate>Wed, 03 Nov 2021 14:27:05 +0000</pubDate>
				<guid isPermaLink="false">https://help.hostry.com/?post_type=ht_kb&#038;p=4413</guid>

					<description><![CDATA[As for the new version of Debian 11, the official method of installing MySQL Workbench does not work as expected on Debian 11. Some users who have encountered the installation state the following: the MySQL Workbench repository was not added correctly, and manually adding it does not solve the problem. [&#8230;]]]></description>
										<content:encoded><![CDATA[
<p>As for the new version of Debian 11, the official method of installing MySQL Workbench does not work as expected on Debian 11. Some users who have encountered the installation state the following: the MySQL Workbench repository was not added correctly, and manually adding it does not solve the problem. Other users have complained that manual installation of Ubuntu does not work with Debian, and we can confirm this. However, installing MySQL Workbench on Debian 11 using Snap is pretty straightforward. Before installing MySQL Workbench, update all of your repositories:</p>



<pre class="wp-block-code"><code>apt update</code></pre>



<p>It is recommended that you install the snapd package for Workbench to work properly. This can be installed by running the following command:</p>



<pre class="wp-block-code"><code>apt install snapd</code></pre>



<p>Install the kernel files using Snap by running the following command:</p>



<pre class="wp-block-code"><code>snap install core</code></pre>



<p>Now, to install MySQL Workbench using Snap, run the following command:</p>



<pre class="wp-block-code"><code>snap install mysql-workbench-community</code></pre>



<p>Once installed, you can find MySQL Workbench in the application finder, or in the applications menu. In Debian 11, you will see a warning that the operating system is not supported. MySQL Workbench currently supports the following operating systems: Ubuntu, Red Hat Enterprise, Oracle Linux, Fedora, and Microsoft Windows. The fact that your system is not officially supported can be ignored, and this does not mean that you will run into errors. However, below I decided to add some Linux compatible alternatives to MySQL Workbench. More information on MySQL Workbench can be obtained at this <strong><a href="https://www.mysql.com/products/workbench/">link</a></strong>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://help.hostry.com/knowledge-base/how-to-install-mysql-workbench-on-debian-11/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>How To Make a  Backup and Restore MySQL on Ubuntu 20.04</title>
		<link>https://help.hostry.com/knowledge-base/how-to-make-a-backup-and-restore-mysql-on-ubuntu-20-04/</link>
					<comments>https://help.hostry.com/knowledge-base/how-to-make-a-backup-and-restore-mysql-on-ubuntu-20-04/#comments</comments>
		
		<dc:creator><![CDATA[Alex]]></dc:creator>
		<pubDate>Thu, 21 Oct 2021 10:29:07 +0000</pubDate>
				<guid isPermaLink="false">https://help.hostry.com/?post_type=ht_kb&#038;p=4377</guid>

					<description><![CDATA[When working with databases, you have to make backups. This tutorial will focus on MySQL on Ubuntu 20.04. The process will be described in detailed commands and also to secure your data. Copying your data from the Ubuntu server First, you need to be logged in as a user with [&#8230;]]]></description>
										<content:encoded><![CDATA[
<p>When working with databases, you have to make backups. This tutorial will focus on MySQL on Ubuntu 20.04. The process will be described in detailed commands and also to secure your data.</p>



<h2 id="copying-your-data-from-the-ubuntu-server" >Copying your data from the Ubuntu server</h2>



<p>First, you need to be logged in as a user with root privileges. After successful login, you need to check the list of databases. This can be done by entering a simple command:</p>



<pre class="wp-block-code"><code>mysql -u USERNAME</code></pre>



<p>Further, after a successful login, you need to enter a special command that will provide you with the entire list of databases. This command looks like this:</p>



<pre class="wp-block-code"><code>SHOW DATABASES;
+--------------------+
| Database           |
+--------------------+
| test_data          |
| important_db       |
| information_schema |
| mysql              |
| performance_schema |
+--------------------+
5 rows in set (0.012 sec)</code></pre>



<p>Then you can close the command line by typing <strong><em>exit;</em></strong></p>



<h2 id="using-mysqldump" >Using Mysqldump</h2>



<p>You may need to use a password for login. To do this, just add<strong> -p</strong> to the command below. If you need to keep all databases, you can use the shortcut <strong>&#8211;all-databases</strong> instead of<strong> &#8211;databases names</strong></p>



<pre class="wp-block-code"><code>mysqldump -u USERNAME --databases test_data important_db &gt; database_dump.sql</code></pre>



<p>Then the file is <em>automatically </em>generated. It will be named <strong>&#8220;database_dump.sql&#8221;</strong>. Its content includes all data for restoring the databases that you specify.</p>



<h2 id="protecting-your-backup-process" >Protecting Your Backup Process</h2>



<p>An important recommendation: if the data in the database contains sensitive data, then you should definitely encrypt it before you save or start the process of moving between servers. Run the first command below and then enter your password; it will not appear on your screen.</p>



<pre class="wp-block-code"><code>openssl enc -aes-256-cbc -pbkdf2 -in database_dump.sql -out database_dump.sql.enc
  enter aes-256-cbc encryption password:
  Verifying - enter aes-256-cbc encryption password:


rm database_dump.sql</code></pre>



<p>In order for you to be able to decrypt your backup, you can use a special command, which is indicated below:</p>



<pre class="wp-block-code"><code>openssl enc -d -aes-256-cbc -pbkdf2 -in database_dump.sql.enc -out database_dump.sql
  enter aes-256-cbc encryption password:</code></pre>



<h2 id="the-process-of-moving-a-backup" >The process of moving a backup</h2>



<p>During the backup process, the .sql size can be bulky in size. This will negatively affect the file and data transfer process. Instead, you can use tools such as rsync to exchange data directly between servers.</p>



<pre class="wp-block-code"><code>rsync -a ./database_dump.sql user@185.186.244.123:/tmp/</code></pre>



<blockquote class="wp-block-quote"><p><strong>185.186.244.123</strong> &#8211; should be changed to your server address<br><strong>user</strong> is the username on the remote server<br><strong> tmp/</strong> &#8211; should be replaced with your remote server directory</p></blockquote>



<p>To restore your database, you can use the special <strong>mysql</strong> utility, an example is shown below:</p>



<pre class="wp-block-code"><code>mysql -u USERNAME &lt;database_dump.sql</code></pre>
]]></content:encoded>
					
					<wfw:commentRss>https://help.hostry.com/knowledge-base/how-to-make-a-backup-and-restore-mysql-on-ubuntu-20-04/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
			</item>
	</channel>
</rss>
