<?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>Archives des MariaDB - CoffeeBreak Info</title>
	<atom:link href="https://coffeebreak.en-images.info/tag/mariadb/feed/" rel="self" type="application/rss+xml" />
	<link>https://coffeebreak.en-images.info/tag/mariadb/</link>
	<description>Une petite pause :)</description>
	<lastBuildDate>Fri, 12 Nov 2021 18:25:36 +0000</lastBuildDate>
	<language>fr-FR</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.1</generator>

<image>
	<url>https://coffeebreak.en-images.info/wp-content/uploads/2021/07/cropped-Tasse_Cafe-scaled-1-32x32.jpg</url>
	<title>Archives des MariaDB - CoffeeBreak Info</title>
	<link>https://coffeebreak.en-images.info/tag/mariadb/</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>MODOP – Autoriser des connexions Distantes à MariaDB</title>
		<link>https://coffeebreak.en-images.info/modop-autoriser-des-connexions-distantes-a-mariadb/</link>
					<comments>https://coffeebreak.en-images.info/modop-autoriser-des-connexions-distantes-a-mariadb/#respond</comments>
		
		<dc:creator><![CDATA[chris]]></dc:creator>
		<pubDate>Tue, 09 Nov 2021 11:14:16 +0000</pubDate>
				<category><![CDATA[Applications]]></category>
		<category><![CDATA[Cluster Mysql/MariaDB]]></category>
		<category><![CDATA[Système]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[MariaDB]]></category>
		<category><![CDATA[Mysql]]></category>
		<category><![CDATA[Serveur]]></category>
		<guid isPermaLink="false">https://coffeebreak.en-images.info/?p=4688</guid>

					<description><![CDATA[<p>Ce MODOP évoque la mise en place d'une connexion distante sur une base de donnée MariaDB.<br />
Le but est de permettre à un client host habilité de pouvoir accéder à des données d’une base de données distante via un compte invité.<br />
Attention, ce type d’accès doit être réfléchi et surtout bien cadré afin d’éviter les compromissions d’accès de données. Il est souvent conseillé d’ajouter une couche SSL à la connexion distante</p>
<p>L’article <a href="https://coffeebreak.en-images.info/modop-autoriser-des-connexions-distantes-a-mariadb/">MODOP – Autoriser des connexions Distantes à MariaDB</a> est apparu en premier sur <a href="https://coffeebreak.en-images.info">CoffeeBreak Info</a>.</p>
]]></description>
										<content:encoded><![CDATA[<h2><span style="text-decoration: underline; color: #000000;"><strong>1°) Partie Serveur MySQL</strong></span></h2>
<p><strong>Machine Serveur</strong></p>
<ul>
<li>Hosts&nbsp;: <strong>slqssl.house.cpb</strong></li>
<li>Mémoire&nbsp;: 2Go</li>
<li>vCPU&nbsp;: 2</li>
<li>Disque&nbsp;: 8Go</li>
<li>OS&nbsp;: AlmaLinux 8</li>
<li>Network&nbsp;: <strong>192.168.1.4</strong></li>
</ul>
<p><strong>Update de la machine </strong></p>
<pre>[root@sqlssl ~]#<span style="color: #ff0000;"> dnf -y update</span></pre>
<p><strong>Installation Mysql server </strong></p>
<pre>[root@sqlssl ~]# <span style="color: #ff0000;">yum install mariadb-server</span></pre>
<p><strong>Démarrage des services</strong></p>
<pre>[root@sqlssl ~]# <span style="color: #ff0000;">systemctl enable mariadb</span>
[root@sqlssl ~]# <span style="color: #ff0000;">systemctl start mariadb</span>
[root@sqlssl ~]# <span style="color: #ff0000;">systemctl status mariadb</span></pre>
<p><img fetchpriority="high" decoding="async" width="952" height="240" class="wp-image-4690" src="https://coffeebreak.en-images.info/wp-content/uploads/2021/11/word-image-143.png" srcset="https://coffeebreak.en-images.info/wp-content/uploads/2021/11/word-image-143.png 952w, https://coffeebreak.en-images.info/wp-content/uploads/2021/11/word-image-143-300x76.png 300w, https://coffeebreak.en-images.info/wp-content/uploads/2021/11/word-image-143-768x194.png 768w" sizes="(max-width: 952px) 100vw, 952px" /></p>
<p><strong>Configuration de MySQL</strong></p>
<pre>[root@sqlssl ~]#<span style="color: #ff0000;"> mysql_secure_installation</span></pre>
<p>Enter current password for root (enter for none):<strong><span style="color: #ff0000;">ENTER</span></strong><br />
Set root password? [Y/n]<span style="color: #ff0000;"><strong> y</strong></span><br />
Remove anonymous users? [Y/n] <span style="color: #ff0000;"><strong>y</strong></span><br />
Disallow root login remotely? [Y/n] <span style="color: #ff0000;"><strong>y</strong></span><br />
Remove test database and access to it? [Y/n] <span style="color: #ff0000;"><strong>y</strong></span><br />
Reload privilege tables now? [Y/n] <span style="color: #ff0000;"><strong>y</strong></span></p>
<p><img decoding="async" width="959" height="827" class="wp-image-4691" src="https://coffeebreak.en-images.info/wp-content/uploads/2021/11/word-image-144.png" srcset="https://coffeebreak.en-images.info/wp-content/uploads/2021/11/word-image-144.png 959w, https://coffeebreak.en-images.info/wp-content/uploads/2021/11/word-image-144-300x259.png 300w, https://coffeebreak.en-images.info/wp-content/uploads/2021/11/word-image-144-768x662.png 768w" sizes="(max-width: 959px) 100vw, 959px" /></p>
<p><strong>Test de connexion root@localhost</strong></p>
<pre>[root@sqlssl ~]# <span style="color: #ff0000;">mysql -u root -p</span></pre>
<p><img decoding="async" width="658" height="162" class="wp-image-4692" src="https://coffeebreak.en-images.info/wp-content/uploads/2021/11/word-image-145.png" srcset="https://coffeebreak.en-images.info/wp-content/uploads/2021/11/word-image-145.png 658w, https://coffeebreak.en-images.info/wp-content/uploads/2021/11/word-image-145-300x74.png 300w" sizes="(max-width: 658px) 100vw, 658px" /><br />
mysql&gt; <span style="color: #ff0000;">select user,host from mysql.user;</span><br />
<img loading="lazy" decoding="async" width="591" height="173" class="wp-image-4693" src="https://coffeebreak.en-images.info/wp-content/uploads/2021/11/word-image-146.png" srcset="https://coffeebreak.en-images.info/wp-content/uploads/2021/11/word-image-146.png 591w, https://coffeebreak.en-images.info/wp-content/uploads/2021/11/word-image-146-300x88.png 300w" sizes="auto, (max-width: 591px) 100vw, 591px" /></p>
<p><strong>Ajout de nos hosts (no DNS)</strong></p>
<pre>[root@sqlssl ~]#<span style="color: #ff0000;"> echo "192.168.1.4 sqlssl.house.cpb sqlssl" &gt;&gt; /etc/hosts</span>
[root@sqlssl ~]# <span style="color: #ff0000;">echo "192.168.1.5 sql-client.house.cpb sql-client" &gt;&gt; /etc/hosts</span>
[root@sqlssl ~]# <span style="color: #ff0000;">echo "192.168.1.6 sql-client01.house.cpb sql-client01" &gt;&gt; /etc/hosts</span></pre>
<p><strong>Création d’un utilisateur distant pour notre client « sql-client.house.cpb »</strong></p>
<pre>[root@sqlssl ~]# <span style="color: #ff0000;">mysql -u root –p</span></pre>
<p>mysql&gt; <span style="color: #ff0000;">CREATE USER « chris »@ »sql-client.house.cpb » IDENTIFIED BY « votre_mot_de_passe »;</span><br />
<span style="color: #ff0000;"><em>Query OK, 0 rows affected (0.01 sec)</em></span></p>
<p>mysql&gt; <span style="color: #ff0000;">GRANT SELECT, SHOW DATABASES ON *.* TO <a style="color: #ff0000;" href="mailto:%22chris%22@%22sql-client.house.cpb%22%20">« chris »@ »sql-client.house.cpb » </a>;</span><br />
<span style="color: #ff0000;"><em>Query OK, 0 rows affected (0.01 sec)</em></span></p>
<p>mysql&gt;<span style="color: #ff0000;"> FLUSH PRIVILEGES;</span><br />
<span style="color: #ff0000;"><em>Query OK, 0 rows affected (0.01 sec)</em></span></p>
<p>mysql&gt; <span style="color: #ff0000;">select user,host from mysql.user;</span><br />
<img loading="lazy" decoding="async" width="519" height="150" class="wp-image-4694" src="https://coffeebreak.en-images.info/wp-content/uploads/2021/11/word-image-147.png" srcset="https://coffeebreak.en-images.info/wp-content/uploads/2021/11/word-image-147.png 519w, https://coffeebreak.en-images.info/wp-content/uploads/2021/11/word-image-147-300x87.png 300w" sizes="auto, (max-width: 519px) 100vw, 519px" /></p>
<p><strong>Rules Firewall</strong></p>
<pre>[root@sqlssl ~]#<span style="color: #ff0000;"> firewall-cmd --zone=public --permanent --add-port=3306/tcp</span>
[root@sqlssl ~]#<span style="color: #ff0000;"> firewall-cmd --reload</span>
[root@sqlssl ~]# <span style="color: #ff0000;">dnf install nmap</span>
[root@sqlssl ~]# <span style="color: #ff0000;">nmap localhost</span></pre>
<p><strong><img loading="lazy" decoding="async" width="640" height="190" class="wp-image-4695" src="https://coffeebreak.en-images.info/wp-content/uploads/2021/11/word-image-148.png" srcset="https://coffeebreak.en-images.info/wp-content/uploads/2021/11/word-image-148.png 640w, https://coffeebreak.en-images.info/wp-content/uploads/2021/11/word-image-148-300x89.png 300w" sizes="auto, (max-width: 640px) 100vw, 640px" /></strong></p>
<h2><span style="text-decoration: underline; color: #000000;"><strong>2°) Check connexion Client « sql-client » sur MySQL</strong></span></h2>
<p><strong>Machine Client</strong></p>
<ul>
<li>Hosts&nbsp;: <strong>slq-client.house.cpb</strong></li>
<li>Mémoire&nbsp;: 2Go</li>
<li>vCPU&nbsp;: 2</li>
<li>Disque&nbsp;: 8Go</li>
<li>OS&nbsp;: AlmaLinux 8</li>
<li>Network&nbsp;: <strong>192.168.1.5</strong></li>
</ul>
<p><strong>Update de la machine </strong></p>
<pre>[root@sql-client ~]#<span style="color: #ff0000;"> dnf -y update</span></pre>
<p><strong>Ajout de nos hosts (no DNS)</strong></p>
<pre>[root@ sql-client ~]#<span style="color: #ff0000;"> echo "192.168.1.4 sqlssl.house.cpb sqlssl" &gt;&gt; /etc/hosts</span>
[root@ sql-client ~]#<span style="color: #ff0000;"> echo "192.168.1.5 sql-client.house.cpb sql-client" &gt;&gt; /etc/hosts</span></pre>
<p><strong>Installation du Client Mysql</strong></p>
<pre>[root@ sql-client ~]# <span style="color: #ff0000;">dnf install mysql</span>
[root@sql-client ~]# <span style="color: #ff0000;">mysql -u chris -p -h sqlssl</span>
mysql&gt; <span style="color: #ff0000;">select user,host from mysql.user;</span></pre>
<p><img loading="lazy" decoding="async" width="812" height="362" class="wp-image-4696" src="https://coffeebreak.en-images.info/wp-content/uploads/2021/11/word-image-149.png" srcset="https://coffeebreak.en-images.info/wp-content/uploads/2021/11/word-image-149.png 812w, https://coffeebreak.en-images.info/wp-content/uploads/2021/11/word-image-149-300x134.png 300w, https://coffeebreak.en-images.info/wp-content/uploads/2021/11/word-image-149-768x342.png 768w" sizes="auto, (max-width: 812px) 100vw, 812px" /></p>
<p><strong>Nous avons bien une autorisation de connexion sur notre serveur de base de donnée.</strong></p>
<h2><span style="text-decoration: underline; color: #000000;"><strong>3°) Check connexion Client « sql-client01 » sur MySQL</strong></span></h2>
<p><strong>Machine Client01</strong></p>
<ul>
<li>Hosts&nbsp;: <strong>slq-client01.house.cpb</strong></li>
<li>Mémoire&nbsp;: 2Go</li>
<li>vCPU&nbsp;: 2</li>
<li>Disque&nbsp;: 8Go</li>
<li>OS&nbsp;: AlmaLinux 8</li>
<li>Network&nbsp;: <strong>192.168.1.6</strong></li>
</ul>
<p><strong>Update de la machine </strong></p>
<pre>[root@sql-client01~]# <span style="color: #ff0000;">dnf -y update</span></pre>
<p><strong>Ajout de nos hosts (no DNS)</strong></p>
<pre>[root@ sql-client01~]# <span style="color: #ff0000;">echo "192.168.1.4 sqlssl.house.cpb sqlssl" &gt;&gt; /etc/hosts</span>
[root@ sql-client01~]#<span style="color: #ff0000;"> echo "192.168.1.6 sql-client01.house.cpb sql-client01" &gt;&gt; /etc/hosts</span></pre>
<p><strong>Installation du Client Mysql</strong></p>
<pre>[root@ sql-client01~]# dnf install mysql</pre>
<pre>[root@ sql-client01~]# <span style="color: #ff0000;">mysql -u chris -p -h sqlssl</span></pre>
<p><img loading="lazy" decoding="async" width="807" height="81" class="wp-image-4697" src="https://coffeebreak.en-images.info/wp-content/uploads/2021/11/word-image-150.png" srcset="https://coffeebreak.en-images.info/wp-content/uploads/2021/11/word-image-150.png 807w, https://coffeebreak.en-images.info/wp-content/uploads/2021/11/word-image-150-300x30.png 300w, https://coffeebreak.en-images.info/wp-content/uploads/2021/11/word-image-150-768x77.png 768w, https://coffeebreak.en-images.info/wp-content/uploads/2021/11/word-image-150-800x81.png 800w" sizes="auto, (max-width: 807px) 100vw, 807px" /></p>
<p><strong>Nous avons bien un rejet de connexion sur notre serveur de base de donnée.</strong></p>
<p>Views: 23</p><p>L’article <a href="https://coffeebreak.en-images.info/modop-autoriser-des-connexions-distantes-a-mariadb/">MODOP – Autoriser des connexions Distantes à MariaDB</a> est apparu en premier sur <a href="https://coffeebreak.en-images.info">CoffeeBreak Info</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://coffeebreak.en-images.info/modop-autoriser-des-connexions-distantes-a-mariadb/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>MODOP &#8211; Réplication MASTER – MASTER entre Deux bases Mysql</title>
		<link>https://coffeebreak.en-images.info/modop-replication-master-master-entre-deux-bases-mysql/</link>
					<comments>https://coffeebreak.en-images.info/modop-replication-master-master-entre-deux-bases-mysql/#respond</comments>
		
		<dc:creator><![CDATA[chris]]></dc:creator>
		<pubDate>Sat, 05 Jun 2021 15:50:16 +0000</pubDate>
				<category><![CDATA[Debian Linux]]></category>
		<category><![CDATA[Cluster]]></category>
		<category><![CDATA[Debian]]></category>
		<category><![CDATA[HA]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[MariaDB]]></category>
		<category><![CDATA[Mysql]]></category>
		<guid isPermaLink="false">https://coffeebreak.en-images.info/?p=1074</guid>

					<description><![CDATA[<p>Mise en Place d'une réplication Master-Master entre deux bases de données MySQL Toute donnée arrivant sur une base sera répliqué sur la deuxième.</p>
<p>L’article <a href="https://coffeebreak.en-images.info/modop-replication-master-master-entre-deux-bases-mysql/">MODOP &#8211; Réplication MASTER – MASTER entre Deux bases Mysql</a> est apparu en premier sur <a href="https://coffeebreak.en-images.info">CoffeeBreak Info</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p><strong>Prérequis :</strong></p>
<ul>
<li>Serveur sql01.house.cpb  IP 192.168.1.62</li>
<li>Serveur sql02.house.cpb  IP 192.168.1.63</li>
</ul>
<p><strong>Dans le DNS :</strong></p>
<ul>
<li>sql.house.cpb. IN A 192.168.1.62</li>
<li>sql.house.cpb. IN A 192.168.1.63</li>
</ul>
<h4><span style="text-decoration: underline;"><strong>1° ) Installation Base de données/PhpMyadmin (ql01.house.cpb/sql02.house.cpb)</strong></span></h4>
<pre>root@sql01:/home/sysbreak# <span style="color: #ff0000;"><strong>apt-get install mysql-server mysql-client</strong></span>
root@sql01:/home/sysbreak# <strong><span style="color: #ff0000;">systemctl enable mariadb.service</span></strong>
root@sql01:/home/sysbreak#<span style="color: #ff0000;"><strong> systemctl start mariadb.service</strong></span></pre>
<p><strong>Configuration</strong></p>
<pre>root@sql01:/home/sysbreak# <strong><span style="color: #ff0000;">mysql_secure_installation</span></strong>

NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!
In order to log into MariaDB to secure it, we'll need the current
password for the root user. If you've just installed MariaDB, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.

Enter current password for root (enter for none): <span style="color: #ff0000;"><strong>« ENTER »</strong></span>
OK, successfully used password, moving on...

Setting the root password ensures that nobody can log into the MariaDB
root user without the proper authorisation.
Set root password? [Y/n] <span style="color: #ff0000;"><strong>yes</strong></span>
New password:
Re-enter new password:
Password updated successfully!
Reloading privilege tables..
... Success!

By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB without having to have a user account created for
them. This is intended only for testing, and to make the installation
go a bit smoother. You should remove them before moving into a
production environment.
Remove anonymous users? [Y/n]<span style="color: #ff0000;"><strong> y</strong></span>
... Success!

Normally, root should only be allowed to connect from 'localhost'. This
ensures that someone cannot guess at the root password from the network.
Disallow root login remotely? [Y/n]<span style="color: #ff0000;"><strong> n</strong></span>
... skipping.

By default, MariaDB comes with a database named 'test' that anyone can
access. This is also intended only for testing, and should be removed
before moving into a production environment.
Remove test database and access to it? [Y/n] <span style="color: #ff0000;"><strong>n</strong></span>
... skipping.

Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.
Reload privilege tables now? [Y/n] <strong><span style="color: #ff0000;">y</span></strong>
... Success!
Cleaning up...

All done! If you've completed all of the above steps, your MariaDB
installation should now be secure.
Thanks for using MariaDB!</pre>
<p><strong>Installer PhpMyAdmin</strong></p>
<pre>root@sql01:/etc# <strong><span style="color: #ff0000;">apt install phpmyadmin</span></strong></pre>
<p><img loading="lazy" decoding="async" width="855" height="241" class="wp-image-1076" src="https://coffeebreak.en-images.info/wp-content/uploads/2021/06/word-image-209.png" srcset="https://coffeebreak.en-images.info/wp-content/uploads/2021/06/word-image-209.png 855w, https://coffeebreak.en-images.info/wp-content/uploads/2021/06/word-image-209-300x85.png 300w, https://coffeebreak.en-images.info/wp-content/uploads/2021/06/word-image-209-768x216.png 768w" sizes="auto, (max-width: 855px) 100vw, 855px" /><br />
« apache2 »</p>
<p><img loading="lazy" decoding="async" width="1467" height="285" class="wp-image-1078" src="https://coffeebreak.en-images.info/wp-content/uploads/2021/06/word-image-210.png" srcset="https://coffeebreak.en-images.info/wp-content/uploads/2021/06/word-image-210.png 1467w, https://coffeebreak.en-images.info/wp-content/uploads/2021/06/word-image-210-300x58.png 300w, https://coffeebreak.en-images.info/wp-content/uploads/2021/06/word-image-210-1024x199.png 1024w, https://coffeebreak.en-images.info/wp-content/uploads/2021/06/word-image-210-768x149.png 768w" sizes="auto, (max-width: 1467px) 100vw, 1467px" /><br />
« oui »</p>
<p><img loading="lazy" decoding="async" width="673" height="216" class="wp-image-1079" src="https://coffeebreak.en-images.info/wp-content/uploads/2021/06/word-image-211.png" srcset="https://coffeebreak.en-images.info/wp-content/uploads/2021/06/word-image-211.png 673w, https://coffeebreak.en-images.info/wp-content/uploads/2021/06/word-image-211-300x96.png 300w" sizes="auto, (max-width: 673px) 100vw, 673px" /><br />
« Taper un mot de passe »</p>
<p><img loading="lazy" decoding="async" width="439" height="219" class="wp-image-1081" src="https://coffeebreak.en-images.info/wp-content/uploads/2021/06/word-image-212.png" srcset="https://coffeebreak.en-images.info/wp-content/uploads/2021/06/word-image-212.png 439w, https://coffeebreak.en-images.info/wp-content/uploads/2021/06/word-image-212-300x150.png 300w" sizes="auto, (max-width: 439px) 100vw, 439px" /><br />
« Confirmer le mot de passe »</p>
<p>Régler le Souci suivant :<br />
<img loading="lazy" decoding="async" width="415" height="452" class="wp-image-1084" src="https://coffeebreak.en-images.info/wp-content/uploads/2021/06/word-image-213.png" srcset="https://coffeebreak.en-images.info/wp-content/uploads/2021/06/word-image-213.png 415w, https://coffeebreak.en-images.info/wp-content/uploads/2021/06/word-image-213-275x300.png 275w" sizes="auto, (max-width: 415px) 100vw, 415px" /></p>
<pre>root@sql01:/etc/apache2# <span style="color: #ff0000;"><strong>mysql --user=root mysql</strong></span>
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 16
Server version: 10.1.38-MariaDB-0+deb9u1 Debian 9.8

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [mysql]&gt;<strong><span style="color: #ff0000;"> use mysql;</span></strong>
Database changed
MariaDB [mysql]&gt; <strong><span style="color: #ff0000;">update user set plugin='' where User='root';</span></strong>
Query OK, 1 row affected (0.00 sec)
Rows matched: 1 Changed: 1 Warnings: 0

MariaDB [mysql]&gt; <strong><span style="color: #ff0000;">flush privileges;</span></strong>
Query OK, 0 rows affected (0.00 sec)

MariaDB [mysql]&gt;<strong><span style="color: #ff0000;"> exit;</span></strong></pre>
<h4><span style="text-decoration: underline;"><strong>2°) Modifier les Fichier Systèmes my.cnf pour les Deux Servers SQL01 et SQL02</strong></span></h4>
<p><span style="text-decoration: underline;"><strong>Pour le Serveur SQL01</strong></span></p>
<pre>chris@sql01:/etc/mysql$<span style="color: #ff0000;"><strong> vi my.cnf</strong></span>
Ajouter les Lignes Suivantes
<span style="color: #ff0000;"><em>[mysqld]</em></span>
<span style="color: #ff0000;"><em>server_id = 1</em></span>
<span style="color: #ff0000;"><em>log_bin = /var/log/mysql/mysql-bin.log</em></span>
<span style="color: #ff0000;"><em>log_bin_index = /var/log/mysql/mysql-bin.log.index</em></span>
<span style="color: #ff0000;"><em>relay_log = /var/log/mysql/mysql-relay-bin</em></span>
<span style="color: #ff0000;"><em>relay_log_index = /var/log/mysql/mysql-relay-bin.index</em></span>
<span style="color: #ff0000;"><em>expire_logs_days = 10</em></span>
<span style="color: #ff0000;"><em>max_binlog_size = 100M</em></span>
<span style="color: #ff0000;"><em>log_slave_updates = 1</em></span>
<span style="color: #ff0000;"><em>auto-increment-increment = 2</em></span>
<span style="color: #ff0000;"><em>auto-increment-offset = 1</em></span></pre>
<p><strong>éditer le fichier 50-server.conf</strong></p>
<pre>chris@sql01:/etc/mysql$ <strong><span style="color: #ff0000;">vi ./mariadb.conf.d/50-server.cnf</span></strong>
<span style="color: #ff0000;"><em>Modifier la bind-address</em></span>
<span style="color: #ff0000;"><em>bind-address = 192.168.1.62</em></span> (Adresse du Serveur SQL01)</pre>
<p><strong>Redémarrer le serveur de base de données.</strong></p>
<p><strong><span style="text-decoration: underline;">Pour le Serveur SQL02</span></strong></p>
<pre>chris@sql02:/etc/mysql$<strong><span style="color: #ff0000;"> vi my.cnf</span></strong></pre>
<pre>#Ajouter les Lignes Suivantes
<span style="color: #ff0000;"><em>[mysqld]</em></span>
<span style="color: #ff0000;"><em>server_id = 2</em></span>
<span style="color: #ff0000;"><em>log_bin = /var/log/mysql/mysql-bin.log</em></span>
<span style="color: #ff0000;"><em>log_bin_index = /var/log/mysql/mysql-bin.log.index</em></span>
<span style="color: #ff0000;"><em>relay_log = /var/log/mysql/mysql-relay-bin</em></span>
<span style="color: #ff0000;"><em>relay_log_index = /var/log/mysql/mysql-relay-bin.index</em></span>
<span style="color: #ff0000;"><em>expire_logs_days = 10</em></span>
<span style="color: #ff0000;"><em>max_binlog_size = 100M</em></span>
<span style="color: #ff0000;"><em>log_slave_updates = 1</em></span>
<span style="color: #ff0000;"><em>auto-increment-increment = 2</em></span>
<span style="color: #ff0000;"><em>auto-increment-offset = 2</em></span></pre>
<p><strong>éditer le fichier 50-server.conf</strong></p>
<pre>chris@sql02:/etc/mysql$ <strong><span style="color: #ff0000;">vi ./mariadb.conf.d/50-server.cnf</span></strong>
<span style="color: #ff0000;"><em>Modifier la bind-address</em></span>
<span style="color: #ff0000;"><em>bind-address = 192.168.1.63</em></span> (Adresse du Serveur SQL02)</pre>
<p><strong>Redémarrer le serveur de base de données.</strong><br />
Vérifier que les deux server SQL01 et SQL02 écoute sur leurs adresses IP et non Localhost</p>
<p><img loading="lazy" decoding="async" width="627" height="205" class="wp-image-1086" src="https://coffeebreak.en-images.info/wp-content/uploads/2021/06/word-image-214.png" srcset="https://coffeebreak.en-images.info/wp-content/uploads/2021/06/word-image-214.png 627w, https://coffeebreak.en-images.info/wp-content/uploads/2021/06/word-image-214-300x98.png 300w" sizes="auto, (max-width: 627px) 100vw, 627px" /></p>
<h4><span style="text-decoration: underline;"><strong>3°) Création du compte ‘replication’ pour la réplication (à faire sur les deux bases)</strong></span></h4>
<p><span style="text-decoration: underline;"><strong>Sur Sql01</strong></span></p>
<p><strong>On va créer un compte user ‘replication’ avec l’IP de SQL02 (192.168.1.63)</strong><br />
<span style="color: #ff0000;"><em>GRANT REPLICATION SLAVE ON *.* TO &lsquo;replication&rsquo;@&rsquo;192.168.1.63&rsquo; IDENTIFIED BY &lsquo;replication@2019&rsquo;;</em></span></p>
<pre>root@sql01:/etc# <strong><span style="color: #ff0000;">mysql -u root –p</span></strong>
Enter password: <span style="color: #ff0000;"><strong>« PASWORD »</strong></span>

Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 7
Server version: 10.1.38-MariaDB-0+deb9u1 Debian 9.8
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]&gt;<strong><span style="color: #ff0000;"> GRANT REPLICATION SLAVE ON *.* TO 'replication'@'192.168.1.63' IDENTIFIED BY 'replication@2019';</span></strong>
Query OK, 0 rows affected (0.00 sec)</pre>
<p><span style="text-decoration: underline;"><strong>Sur Sql02</strong></span></p>
<p><strong>On va créer un compte user ‘replication’ avec l’IP de SQL01 (192.168.1.62)</strong><br />
<span style="color: #ff0000;"><em>GRANT REPLICATION SLAVE ON *.* TO &lsquo;replication&rsquo;@&rsquo;192.168.1.62&rsquo; IDENTIFIED BY &lsquo;replication@2019&rsquo;;</em></span></p>
<pre>root@sql01:/etc# <strong><span style="color: #ff0000;">mysql -u root –p</span></strong>
Enter password: <span style="color: #ff0000;"><strong>« PASWORD »</strong></span>

Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 7
Server version: 10.1.38-MariaDB-0+deb9u1 Debian 9.8
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]&gt; <strong><span style="color: #ff0000;">GRANT REPLICATION SLAVE ON *.* TO 'replication'@'192.168.1.62' IDENTIFIED BY 'replication@2019';</span></strong>
Query OK, 0 rows affected (0.00 sec)</pre>
<p>Faire un test Croisé sur les deux bases afin de vérifier que les deux bases puissent se connecter entre elles via le compte ‘replication’</p>
<p>Ex : on est sur sql02 et on se connecte sur ma base SQL01 avec le compte ‘replication’*’192.168.1 .62’</p>
<p><img loading="lazy" decoding="async" width="999" height="192" class="wp-image-1087" src="https://coffeebreak.en-images.info/wp-content/uploads/2021/06/word-image-215.png" srcset="https://coffeebreak.en-images.info/wp-content/uploads/2021/06/word-image-215.png 999w, https://coffeebreak.en-images.info/wp-content/uploads/2021/06/word-image-215-300x58.png 300w, https://coffeebreak.en-images.info/wp-content/uploads/2021/06/word-image-215-768x148.png 768w" sizes="auto, (max-width: 999px) 100vw, 999px" /></p>
<h4><span style="text-decoration: underline;"><strong>4°) Réaliser la Réplication Master – Master entre les Deux bases</strong></span></h4>
<p><span style="text-decoration: underline;"><strong>MASTER SQL02</strong></span></p>
<p><strong>Sur SQL01 Récupérer le Status MASTER</strong></p>
<pre>root@sql01:/etc/mysql# <strong><span style="color: #ff0000;">mysql -u root -p</span></strong>
Enter password: <span style="color: #ff0000;"><strong>« PASWORD »</strong></span>
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 17
Server version: 10.1.38-MariaDB-0+deb9u1 Debian 9.8
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]&gt; <span style="color: #ff0000;"><strong>SHOW MASTER STATUS;</strong></span>
<em>+------------------+----------+--------------+------------------+</em>
<em>| File | Position | Binlog_Do_DB | Binlog_Ignore_DB |</em>
<em>+------------------+----------+--------------+------------------+</em>
<em>| <span style="color: #339966;"><strong>mysql-bin.000004</strong></span> | <span style="color: #800080;"><strong>1045</strong> </span>| | |</em>
<em>+------------------+----------+--------------+------------------+</em>
<em>1 row in set (0.00 sec)</em>
MariaDB [(none)]&gt;</pre>
<p><strong>Sur SQL02 intégrer le status MASTER SQL01</strong><br />
A passer dans la requête sur SQL02 ci-dessous</p>
<ul>
<li>Mot de passe réplication de SQLO1</li>
<li>IP de SQL01</li>
<li>Master_log_file de SQL01 (ci-dessus)</li>
<li>Master_log_pos de SQL01 (ci-dessus)</li>
</ul>
<pre>root@sql02:/etc/mysql/mariadb.conf.d# <strong><span style="color: #ff0000;">mysql -u root -p</span></strong>
Enter password: <span style="color: #ff0000;"><strong>« PASWORD »</strong></span>

Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 36
Server version: 10.1.38-MariaDB-0+deb9u1 Debian 9.8
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]&gt; <span style="color: #ff0000;"><strong>STOP SLAVE;</strong></span>
Query OK, 0 rows affected, 1 warning (0.00 sec)

MariaDB [(none)]&gt; <span style="color: #ff0000;"><strong>CHANGE MASTER TO master_host='192.168.1.62' , master_port=3306, master_user='replication' , master_password='replication@2019',master_log_file='<span style="color: #339966;">mysql-bin.000004</span>',master_log_pos=<span style="color: #800080;">1045</span>;</strong></span>
Query OK, 0 rows affected (0.05 sec)

MariaDB [(none)]&gt; <span style="color: #ff0000;"><strong>START SLAVE;</strong></span>
Query OK, 0 rows affected (0.00 sec)</pre>
<p><span style="text-decoration: underline;"><strong>MASTER SQL01</strong></span><br />
Sur SQL02 Récupérer le Status MASTER</p>
<pre>root@sql02:/etc/mysql# <strong><span style="color: #ff0000;">mysql -u root -p</span></strong>
Enter password:

Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 17
Server version: 10.1.38-MariaDB-0+deb9u1 Debian 9.8
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]&gt; <span style="color: #ff0000;"><strong>SHOW MASTER STATUS;</strong></span>
+------------------+----------+--------------+------------------+
| File | Position | Binlog_Do_DB | Binlog_Ignore_DB |
+------------------+----------+--------------+------------------+
|<span style="color: #339966;"><strong> mysql-bin.000002</strong></span> |<span style="color: #800080;"><strong> 1045</strong></span> | | |
<span style="font-size: inherit;"><em>+------------------+----------+--------------+------------------+</em></span></pre>
<p><span style="font-size: inherit;">A passer dans la requête sur SQL01 ci-dessous</span>1 row in set (0.00 sec)<br />
MariaDB [(none)]&gt;<br />
Sur SQL01 intégrer le status MASTER SQL02</p>
<ul>
<li>Mot de passe réplication de SQL02</li>
<li>IP de SQL02</li>
<li>Master_log_file de SQL02 (ci-dessus)</li>
<li>Master_log_pos de SQL02 (ci-dessus)</li>
</ul>
<pre>root@sql01:/etc/mysql/mariadb.conf.d# <span style="color: #ff0000;"><strong>mysql -u root -p</strong></span>
Enter password:<span style="color: #ff0000;"><strong>« PASWORD »</strong></span>

Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 36
Server version: 10.1.38-MariaDB-0+deb9u1 Debian 9.8
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]&gt; <span style="color: #ff0000;"><strong>STOP SLAVE;</strong></span>
Query OK, 0 rows affected, 1 warning (0.00 sec)

MariaDB [(none)]&gt; <strong><span style="color: #ff0000;">CHANGE MASTER TO master_host='192.168.1.63' , master_port=3306, master_user='replication' , master_password='replication@2019',master_log_file='</span><span style="color: #339966;">mysql-bin.000002</span><span style="color: #ff0000;">',master_log_pos=</span><span style="color: #800080;">1045</span>;</strong>
Query OK, 0 rows affected (0.05 sec)

MariaDB [(none)]&gt;<span style="color: #ff0000;"> <strong>START SLAVE;</strong></span>
Query OK, 0 rows affected (0.00 sec)</pre>
<p><span style="text-decoration: underline;"><strong>5°) Test de la Réplication &#8211; Création BASE et TABLE</strong></span></p>
<p>Créer une Table sur SQL01 cela devrait créer la même table sur SQL02</p>
<p><strong>Sur SQL01</strong></p>
<pre>MariaDB [(none)]&gt; <span style="color: #ff0000;"><strong>create database chris;</strong></span>
Query OK, 1 row affected (0.00 sec)

MariaDB [(none)]&gt; <strong><span style="color: #ff0000;">create table chris.flowers (`id` varchar(10));</span></strong>
Query OK, 0 rows affected (0.02 sec)</pre>
<p><strong>Sur SQL02</strong></p>
<pre>MariaDB [(none)]&gt;<strong><span style="color: #ff0000;"> show tables in chris;</span></strong>
<em>+-----------------+</em>
<em>| Tables_in_chris |</em>
<em>+-----------------+</em>
<em>| flowers |</em>
<em>+-----------------+</em>
<em>1 row in set (0.00 sec)</em></pre>
<p><strong><em>La table se retrouve à présen</em>t aussi sur SQL02.</strong></p>
<h4><span style="text-decoration: underline;"><strong>6°) Test suppession TABLE &#8211; Création BASE et TABLE</strong></span></h4>
<p>Supprimer la table ‘chris.flowers’ sur SQL02 er vérifions la suppression sur SQL01.</p>
<p><strong>Sur SQL02</strong></p>
<pre>MariaDB [(none)]&gt; <span style="color: #ff0000;"><strong>drop table chris.flowers;</strong></span>
Query OK, 0 rows affected (0.01 sec)

Sur SQL01
MariaDB [(none)]&gt; <span style="color: #ff0000;"><strong>show tables in chris;</strong></span>
<strong><span style="color: #ff0000;">Empty set (0.00 sec)</span></strong></pre>
<p>La table « chris » est vide donc la réplication fonctionne.</p>
<h4><span style="text-decoration: underline;"><strong>7°) Affichage dans PhpMyAdmin</strong></span></h4>
<p><strong>Affichage PhpMyadmin SQL01</strong><br />
<img loading="lazy" decoding="async" width="1120" height="500" class="wp-image-1089" src="https://coffeebreak.en-images.info/wp-content/uploads/2021/06/word-image-216.png" srcset="https://coffeebreak.en-images.info/wp-content/uploads/2021/06/word-image-216.png 1120w, https://coffeebreak.en-images.info/wp-content/uploads/2021/06/word-image-216-300x134.png 300w, https://coffeebreak.en-images.info/wp-content/uploads/2021/06/word-image-216-1024x457.png 1024w, https://coffeebreak.en-images.info/wp-content/uploads/2021/06/word-image-216-768x343.png 768w" sizes="auto, (max-width: 1120px) 100vw, 1120px" /></p>
<p><strong>Affichage PhpMyadmin SQL02</strong><br />
<img loading="lazy" decoding="async" width="1031" height="467" class="wp-image-1092" src="https://coffeebreak.en-images.info/wp-content/uploads/2021/06/word-image-217.png" srcset="https://coffeebreak.en-images.info/wp-content/uploads/2021/06/word-image-217.png 1031w, https://coffeebreak.en-images.info/wp-content/uploads/2021/06/word-image-217-300x136.png 300w, https://coffeebreak.en-images.info/wp-content/uploads/2021/06/word-image-217-1024x464.png 1024w, https://coffeebreak.en-images.info/wp-content/uploads/2021/06/word-image-217-768x348.png 768w" sizes="auto, (max-width: 1031px) 100vw, 1031px" /></p>
<p>Views: 12</p><p>L’article <a href="https://coffeebreak.en-images.info/modop-replication-master-master-entre-deux-bases-mysql/">MODOP &#8211; Réplication MASTER – MASTER entre Deux bases Mysql</a> est apparu en premier sur <a href="https://coffeebreak.en-images.info">CoffeeBreak Info</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://coffeebreak.en-images.info/modop-replication-master-master-entre-deux-bases-mysql/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
