<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="ca">
	<id>https://www.binefa.com/index.php?action=history&amp;feed=atom&amp;title=Instal%C2%B7laci%C3%B3_MariaDB._Curs_2026-2027</id>
	<title>Instal·lació MariaDB. Curs 2026-2027 - Historial de revisió</title>
	<link rel="self" type="application/atom+xml" href="https://www.binefa.com/index.php?action=history&amp;feed=atom&amp;title=Instal%C2%B7laci%C3%B3_MariaDB._Curs_2026-2027"/>
	<link rel="alternate" type="text/html" href="https://www.binefa.com/index.php?title=Instal%C2%B7laci%C3%B3_MariaDB._Curs_2026-2027&amp;action=history"/>
	<updated>2026-09-17T16:05:24Z</updated>
	<subtitle>Historial de revisió per a aquesta pàgina del wiki</subtitle>
	<generator>MediaWiki 1.33.0</generator>
	<entry>
		<id>https://www.binefa.com/index.php?title=Instal%C2%B7laci%C3%B3_MariaDB._Curs_2026-2027&amp;diff=12483&amp;oldid=prev</id>
		<title>Jordi Binefa: Es crea la pàgina amb «= Instal·lació = Actualitzeu els repositoris i instal·leu '''mariadb-server'''  jordi@iot-clot:~$ '''sudo apt update'''  jordi@iot-clot:~$ '''sudo apt install maria...».</title>
		<link rel="alternate" type="text/html" href="https://www.binefa.com/index.php?title=Instal%C2%B7laci%C3%B3_MariaDB._Curs_2026-2027&amp;diff=12483&amp;oldid=prev"/>
		<updated>2026-09-15T15:36:39Z</updated>

		<summary type="html">&lt;p&gt;Es crea la pàgina amb «= Instal·lació = Actualitzeu els repositoris i instal·leu &amp;#039;&amp;#039;&amp;#039;mariadb-server&amp;#039;&amp;#039;&amp;#039;  jordi@iot-clot:~$ &amp;#039;&amp;#039;&amp;#039;sudo apt update&amp;#039;&amp;#039;&amp;#039;  jordi@iot-clot:~$ &amp;#039;&amp;#039;&amp;#039;sudo apt install maria...».&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Pàgina nova&lt;/b&gt;&lt;/p&gt;&lt;div&gt;= Instal·lació =&lt;br /&gt;
Actualitzeu els repositoris i instal·leu '''mariadb-server'''&lt;br /&gt;
 jordi@iot-clot:~$ '''sudo apt update'''&lt;br /&gt;
 jordi@iot-clot:~$ '''sudo apt install mariadb-server'''&lt;br /&gt;
Protegiu l'accés a la base de dades MariaDB. (Proposta de contrasenya per a l'usuari ''root'': '''fjeclot''')&lt;br /&gt;
 jordi@iot-clot:~$ '''sudo mariadb-secure-installation'''&lt;br /&gt;
 [sudo] contrasenya per a jordi:  &lt;br /&gt;
 &lt;br /&gt;
 NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB&lt;br /&gt;
      SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!&lt;br /&gt;
 &lt;br /&gt;
 In order to log into MariaDB to secure it, we'll need the current&lt;br /&gt;
 password for the root user. If you've just installed MariaDB, and&lt;br /&gt;
 haven't set the root password yet, you should just press enter here.&lt;br /&gt;
 &lt;br /&gt;
 '''Enter current password for root (enter for none): '''&lt;br /&gt;
 OK, successfully used password, moving on... &lt;br /&gt;
 &lt;br /&gt;
 Setting the root password or using the unix_socket ensures that nobody&lt;br /&gt;
 can log into the MariaDB root user without the proper authorisation.&lt;br /&gt;
 &lt;br /&gt;
 You already have your root account protected, so you can safely answer 'n'.&lt;br /&gt;
 &lt;br /&gt;
 '''Switch to unix_socket authentication [Y/n] n'''&lt;br /&gt;
 ... skipping.&lt;br /&gt;
 &lt;br /&gt;
 You already have your root account protected, so you can safely answer 'n'.&lt;br /&gt;
 &lt;br /&gt;
 '''Change the root password? [Y/n] n'''&lt;br /&gt;
 ... skipping.&lt;br /&gt;
 &lt;br /&gt;
 By default, a MariaDB installation has an anonymous user, allowing anyone&lt;br /&gt;
 to log into MariaDB without having to have a user account created for&lt;br /&gt;
 them.  This is intended only for testing, and to make the installation&lt;br /&gt;
 go a bit smoother.  You should remove them before moving into a&lt;br /&gt;
 production environment.&lt;br /&gt;
 &lt;br /&gt;
 '''Remove anonymous users? [Y/n] '''&lt;br /&gt;
 ... Success!&lt;br /&gt;
 &lt;br /&gt;
 Normally, root should only be allowed to connect from 'localhost'.  This&lt;br /&gt;
 ensures that someone cannot guess at the root password from the network.&lt;br /&gt;
 &lt;br /&gt;
 '''Disallow root login remotely? [Y/n] '''&lt;br /&gt;
 ... Success!&lt;br /&gt;
 &lt;br /&gt;
 By default, MariaDB comes with a database named 'test' that anyone can&lt;br /&gt;
 access.  This is also intended only for testing, and should be removed&lt;br /&gt;
 before moving into a production environment.&lt;br /&gt;
 &lt;br /&gt;
 '''Remove test database and access to it? [Y/n] '''&lt;br /&gt;
 - Dropping test database...&lt;br /&gt;
 ... Success!&lt;br /&gt;
 - Removing privileges on test database...&lt;br /&gt;
 ... Success!&lt;br /&gt;
 &lt;br /&gt;
 Reloading the privilege tables will ensure that all changes made so far&lt;br /&gt;
 will take effect immediately.&lt;br /&gt;
 &lt;br /&gt;
 '''Reload privilege tables now? [Y/n] '''&lt;br /&gt;
 ... Success!&lt;br /&gt;
 &lt;br /&gt;
 Cleaning up...&lt;br /&gt;
 &lt;br /&gt;
 All done!  If you've completed all of the above steps, your MariaDB&lt;br /&gt;
 installation should now be secure.&lt;br /&gt;
 &lt;br /&gt;
 Thanks for using MariaDB!&lt;br /&gt;
[https://www.digitalocean.com/community/tutorials/how-to-reset-your-mysql-or-mariadb-root-password Si necessiteu sobreescriure la contrasenya de ''root'' que no recordeu d'una instal·ació anterior]&lt;br /&gt;
&lt;br /&gt;
= Creació d'usuaris =&lt;br /&gt;
[https://www.digitalocean.com/community/tutorials/how-to-create-a-new-user-and-grant-permissions-in-mysql Un tutorial de creació d'usuaris amb diferentes permisos (''privilegis'')]&lt;br /&gt;
&lt;br /&gt;
Des del terminal del sistema operatiu es demana entrar al terminal de MariaDB. El primer cop com a usuari ''root'':&lt;br /&gt;
 mysql -u root -p&lt;br /&gt;
 ''(el sistema demana la contrasenya de l'usuari root)''&lt;br /&gt;
Un cop a dins del terminal de MariaDB es creen els usuarios ''iot'' i ''convidat'' amb les seves respectives contrasenyes. Es crea la base de dades ''aula311'', es donen tots els permisos al usuario ''iot'' i tan sols la lectura a l'usuario ''convidat'':&lt;br /&gt;
 CREATE USER 'iot'@'localhost' IDENTIFIED BY 'iot';&lt;br /&gt;
 CREATE USER 'convidat'@'localhost' IDENTIFIED BY 'benvingut';&lt;br /&gt;
 &lt;br /&gt;
 CREATE DATABASE aula311;&lt;br /&gt;
 SHOW DATABASES;&lt;br /&gt;
 USE aula311;&lt;br /&gt;
 &lt;br /&gt;
 GRANT ALL PRIVILEGES ON aula311.* TO 'iot'@'localhost';&lt;br /&gt;
 GRANT SELECT ON aula311.* TO 'convidat'@'localhost';&lt;br /&gt;
 FLUSH PRIVILEGES;&lt;br /&gt;
Per a visualitzar els vostres usuaris a MariaDB:&lt;br /&gt;
 SELECT User FROM mysql.user;&lt;br /&gt;
= Accés a la base de dades des del terminal =&lt;br /&gt;
Per a accedir a la base de dades hi ha tres usuaris amb permisos diferents:&lt;br /&gt;
&lt;br /&gt;
- '''root''': Té tots els permisos. Pot crear usuaris i bases de dades.&lt;br /&gt;
&lt;br /&gt;
- '''iot''': Té permisos de '''lectura i escriptura''' sobre la base de dades '''aula310'''.&lt;br /&gt;
&lt;br /&gt;
- '''convidat''': Té permisos de '''lectura''' sobre la base de dades '''aula310'''.&lt;br /&gt;
&lt;br /&gt;
Per a accedir al terminal de MariaDB com usuario '''iot''':&lt;br /&gt;
 mysql -u '''iot''' -p&lt;br /&gt;
 (el sistema pregunta per la contrasenya d'aquest usuari. És la que surt a l'apartat anterior després de ''IDENTIFIED BY'')&lt;br /&gt;
&lt;br /&gt;
Per a accedir al terminal de MariaDB com usuario '''convidat''':&lt;br /&gt;
 mysql -u '''convidat''' -p&lt;br /&gt;
 (el sistema pregunta per la contrasenya d'aquest usuari. És la que surt a l'apartat anterior després de ''IDENTIFIED BY'')&lt;/div&gt;</summary>
		<author><name>Jordi Binefa</name></author>
		
	</entry>
</feed>