Certains ont sans doute besoin d'utiliser sur wamp MariaDB et MySQL. Je vais donc vous donner les fichiers à modifier pour ajouter sans encombre MariaDB à WampServer.
Avant de commencer, il faut savoir que MariaDB est un fork de MySQL créé originellement suite au rachat de Sun par Oracle. Pour la petite histoire, MariaDB a été forké par le développeur à l'origine de MySQL Monty Widenius. Une anecdote est que le nom de ce SGDB, Maria, est le nom de la seconde fille de Monty. Vous savez comme j'affectionne tout particulièrement Oracle et pour l'image représentant MariaDB c'est pour moi du Phoque you Oracle
Pour ce tuto, je me base sur la version 2.2 de WampServer et j'utilise comme répertoire d'installation celui par défaut (C:\wamp).
Téléchargement de MariaDBPour commencer, on va télécharger la dernière version stable de MariaDB. Je vous conseille la version 32bits de Windows. Moi ici j'ai choisi la version 5.5.33a. Si le lien de téléchargement fourni par le site ne fonctionne pas, essayez celui-ci.
Une fois que vous avez téléchargé MariaDB, décompressez les fichiers dans le répertoire
C:\wamp\bin\mariadb\mariadb5.5.33a\
Vous devriez avoir ce type de hiérarchie :
Pour intégrer MariaDB à Wamp, il va falloir modifier quelques fichiers :
- uninstall_services.bat
- wampmanager.conf
- wampmanager.tpl
- scripts\config.inc.php
- scripts\refresh.php
- scripts\wampserver.lib.php
Et en créer de nouveaux :
- scripts\switchMariaDBVersion.php
- bin\mariadb\mariadb5.5.33a\my.ini
- bin\mariadb\mariadb5.5.33a\wampserver.conf
Les lignes surlignées sont celles à ajouter.
NET STOP wampapache .\bin\apache\apache2.2.21\bin\httpd.exe -k uninstall -n wampapache NET STOP wampmysqld .\bin\mysql\mysql5.5.16\bin\mysqld.exe --remove wampmysqld NET STOP wampmariadb .\bin\mariadb\mariadb5.5.33a\bin\mysqld.exe --remove wampmariadb wampmanager.exe -quit -id={wampserver}wampmanager.conf
Ajoutez en fin de fichier.
[mariadb] mariadbVersion = "5.5.33a" mariadbLastKnown = 5.5.33a mariadbConfDir = . mariadbConfFile = my.ini mariadbExeDir = bin mariadbExeFile = mysqld.exe mariadbServiceInstallParams = --install-manual wampmariadb mariadbServiceRemoveParams = --remove wampmariadbwampmanager.tpl
Ajoutez les lignes surlignées dans les sections suivantes.
[Services] Name: wampapache Name: wampmysqld Name: wampmariadb
[Menu.Left] ;WAMPMENULEFTSTART Type: separator; Caption: "Powered by Alter Way" Type: item; Caption: "${w_localhost}"; Action: run; FileName: "${c_navigator}"; Parameters: "http://localhost/"; Glyph: 5 Type: item; Caption: "${w_phpmyadmin}"; Action: run; FileName: "${c_navigator}"; Parameters: "http://localhost/phpmyadmin/"; Glyph: 5 Type: item; Caption: "${w_wwwDirectory}"; Action: shellexecute; FileName: "${wwwDir}"; Glyph: 2 Type: submenu; Caption: "Apache"; SubMenu: apacheMenu; Glyph: 3 Type: submenu; Caption: "PHP"; SubMenu: phpMenu; Glyph: 3 Type: submenu; Caption: "MySQL"; SubMenu: mysqlMenu; Glyph: 3 Type: submenu; Caption: "MariaDB"; SubMenu: mariadbMenu; Glyph: 3 Type: separator; Caption: "Debug" Type: item; Caption: "Client XDebug"; Glyph: 6; Action: run; FileName: "${c_installDir}/tools/xdc/xdc.exe" Type: item; Caption: "${c_webgrind}"; Action: run; FileName: "${c_navigator}"; Parameters: "http://localhost/webgrind/"; Glyph: 5 Type: separator; Caption: "Quick Admin" ;Type: servicesubmenu; Caption: "${w_apache}"; Service: wampapache; SubMenu: apache ;Type: servicesubmenu; Caption: "${w_mysql}"; Service: wampmysqld; SubMenu: MySql ;Type: servicesubmenu; Caption: "MariaDB"; Service: wampmariadb; SubMenu: MariaDB Type: item; Caption: "${w_startServices}"; Action: multi; Actions: StartAll Type: item; Caption: "${w_stopServices}"; Action: multi; Actions: StopAll Type: item; Caption: "${w_restartServices}"; Action: multi; Actions: RestartAll Type: separator; Type: item; Caption: "${w_putOnline}"; Action: multi; Actions: onlineoffline ;WAMPMENULEFTEND
[StartAll] ;WAMPSTARTALLSTART Action: service; Service: wampapache; ServiceAction: startresume; Flags: ignoreerrors Action: service; Service: wampmysqld; ServiceAction: startresume; Flags: ignoreerrors Action: service; Service: wampmariadb; ServiceAction: startresume; Flags: ignoreerrors ;WAMPSTARTALLEND [StopAll] ;WAMPSTOPALLSTART Action: service; Service: wampapache; ServiceAction: stop; Flags: ignoreerrors Action: service; Service: wampmysqld; ServiceAction: stop; Flags: ignoreerrors Action: service; Service: wampmariadb; ServiceAction: stop; Flags: ignoreerrors ;WAMPSTOPALLEND [RestartAll] ;WAMPRESTARTALLSTART Action: service; Service: wampapache; ServiceAction: stop; Flags: ignoreerrors waituntilterminated Action: service; Service: wampmysqld; ServiceAction: stop; Flags: ignoreerrors waituntilterminated Action: service; Service: wampmariadb; ServiceAction: stop; Flags: ignoreerrors waituntilterminated Action: service; Service: wampapache; ServiceAction: startresume; Flags: ignoreerrors waituntilterminated Action: service; Service: wampmysqld; ServiceAction: startresume; Flags: ignoreerrors waituntilterminated Action: service; Service: wampmariadb; ServiceAction: startresume; Flags: ignoreerrors waituntilterminated ;WAMPRESTARTALLEND [myexit] ;WAMPMYEXITSTART Action: service; Service: wampapache; ServiceAction: stop; Flags: ignoreerrors Action: service; Service: wampmysqld; ServiceAction: stop; Flags: ignoreerrors Action: service; Service: wampmariadb; ServiceAction: stop; Flags: ignoreerrors Action: exit ;WAMPMYEXITEND
Après la section [mysqlVersion], ajoutez les sections suivantes :
[mariadbMenu] ;WAMPMARIADBMENUSTART Type: submenu; Caption: "Version"; SubMenu: mariadbVersion; Glyph: 3 Type: submenu; Caption: "Service"; SubMenu: mariadbService; Glyph: 3 Type: item; Caption: "MariaDB Console"; Action: run; FileName: "${c_mariadbConsole}";Parameters: "-u root -p"; Glyph: 0 Type: item; Caption: "my.ini"; Glyph: 6; Action: run; FileName: "notepad.exe"; parameters: "${c_mariadbConfFile}" Type: item; Caption: "MariaDB Log"; Glyph: 6; Action: run; FileName: "notepad.exe"; parameters: "${c_installDir}/${logDir}mariadb.log" ;WAMPMARIADBMENUEND [mariadbVersion] ;WAMPMARIADBVERSIONSTART ;WAMPMARIADBVERSIONEND
Après la section [MySqlService], ajoutez la section suivante :
[MariaDBService] ;WAMPMARIADBSERVICESTART Type: separator; Caption: "MariaDB" Type: item; Caption: "${w_startResume}"; Action: service; Service: wampmariadb; ServiceAction: startresume; Glyph: 9 ;Flags: ignoreerrors ;Type: item; Caption: "${w_pauseService}"; Action: service; Service: mariadb; ServiceAction: pause; Glyph: 10 Type: item; Caption: "${w_stopService}"; Action: service; Service: wampmariadb; ServiceAction: stop; Glyph: 11 Type: item; Caption: "${w_restartService}"; Action: service; Service: wampmariadb; ServiceAction: restart; Glyph: 12 Type: separator Type: item; Caption: "${w_installService}"; Action: multi; Actions: MariaDBServiceInstall; Glyph: 8 Type: item; Caption: "${w_removeService}"; Action: multi; Actions: MariaDBServiceRemove; Glyph: 7 ;WAMPMARIADBSERVICEEND
Après la section [MySQLServiceRemove], ajoutez les sections suivantes :
[MariaDBServiceInstall] ;WAMPMARIADBSERVICEINSTALLSTART Action: run; FileName: "${c_mariadbExe}"; Parameters: "${c_mariadbServiceInstallParams}"; ShowCmd: hidden; Flags: ignoreerrors waituntilterminated Action: resetservices; Action: readconfig; ;WAMPMARIADBSERVICEINSTALLEND [MariaDBServiceRemove] ;WAMPMARIADBSERVICEREMOVESTART Action: service; Service: wampmariadb; ServiceAction: stop; Flags: ignoreerrors waituntilterminated Action: run; FileName: "${c_mariadbExe}"; Parameters: "${c_mariadbServiceRemoveParams}"; ShowCmd: hidden; Flags: waituntilterminated Action: resetservices; Action: readconfig; ;WAMPMARIADBSERVICEREMOVEENDscripts\config.inc.php
Après la ligne :
$c_mysqlServiceRemoveParams = $wampConf['mysqlServiceRemoveParams'];
Ajoutez :
$c_mariadbVersion = $wampConf['mariadbVersion']; $c_mariadbServiceInstallParams = $wampConf['mariadbServiceInstallParams']; $c_mariadbServiceRemoveParams = $wampConf['mariadbServiceRemoveParams'];
Après la ligne :
$c_mysqlVersionDir = $wampConf['installDir'].'/bin/mysql';
Ajoutez :
$c_mariadbVersionDir = $wampConf['installDir'].'/bin/mariadb';
Après la ligne :
$c_mysqlConfFile = $c_mysqlVersionDir.'/mysql'.$wampConf['mysqlVersion'].'/'.$wampConf['mysqlConfDir'].'/'.$wampConf['mysqlConfFile'];
Ajoutez :
$c_mariadbExe = $c_mariadbVersionDir.'/mysql'.$wampConf['mariadbVersion'].'/'.$wampConf['mariadbExeDir'].'/'.$wampConf['mariadbExeFile']; $c_mariadbConfFile = $c_mariadbVersionDir.'/mysql'.$wampConf['mariadbVersion'].'/'.$wampConf['mariadbConfDir'].'/'.$wampConf['mariadbConfFile'];
Après la ligne :
$c_mysqlConsole = $c_mysqlVersionDir.'/mysql'.$c_mysqlVersion.'/'.$wampConf['mysqlExeDir'].'/mysql.exe';
Ajoutez :
$c_mariadbConsole = $c_mariadbVersionDir.'/mariadb'.$c_mariadbVersion.'/'.$wampConf['mariadbExeDir'].'/mysql.exe';scripts\refresh.php
Avant la section en commentaire :
// ************************ //on enregistre le fichier ini
Ajoutez :
// ************************ // versions de MariaDB $mariadbVersionList = listDir($c_mariadbVersionDir,'checkMariaDBConf'); $maPattern = ';WAMPMARIADBVERSIONSTART'; $mareplace = $maPattern." "; $mareplacemenu = ''; foreach ($mariadbVersionList as $oneMariaDB) { $oneMariaDBVersion = str_ireplace('mariadb','',$oneMariaDB); if (isset($mariadbConf)) $mariadbConf = NULL; include $c_mariadbVersionDir.'/mysql'.$oneMariaDBVersion.'/'.$wampBinConfFiles; if ($oneMariaDBVersion === $wampConf['mariadbVersion']) $mareplace .= 'Type: item; Caption: "'.$oneMariaDBVersion.'"; Action: multi; Actions:switchMariaDB'.$oneMariaDBVersion.'; Glyph: 13 '; else $mareplace .= 'Type: item; Caption: "'.$oneMariaDBVersion.'"; Action: multi; Actions:switchMariaDB'.$oneMariaDBVersion.' '; $mareplacemenu .= '[switchMariaDB'.$oneMariaDBVersion.'] Action: service; Service: wampmariadb; ServiceAction: stop; Flags: ignoreerrors waituntilterminated Action: run; FileName: "'.$c_mariadbExe.'"; Parameters: "'.$c_mariadbServiceRemoveParams.'"; ShowCmd: hidden; Flags: ignoreerrors waituntilterminated Action: closeservices; Action: run; FileName: "'.$c_phpCli.'";Parameters: "switchMariaDBVersion.php '.$oneMariaDBVersion.'";WorkingDir: "'.$c_installDir.'/scripts"; Flags: waituntilterminated Action: run; FileName: "'.$c_mariadbVersionDir.'/mariadb'.$oneMariaDBVersion.'/'.$mariadbConf['mariadbExeDir'].'/'.$mariadbConf['mariadbExeFile'].'"; Parameters: "'.$mariadbConf['mariadbServiceInstallParams'].'"; ShowCmd: hidden; Flags: waituntilterminated Action: run; FileName: "net"; Parameters: "start wampmariadb"; ShowCmd: hidden; Flags: waituntilterminated Action: run; FileName: "'.$c_phpCli.'";Parameters: "-c . refresh.php";WorkingDir: "'.$c_installDir.'/scripts"; Flags: waituntilterminated Action: resetservices; Action: readconfig; '; } $mareplace .= 'Type: separator; Type: item; Caption: "More infos..."; Action: run; FileName: "'.$c_navigator.'"; Parameters: "http://www.crazyws.fr/dev/ajouter-mariadb-sur-wampserver-et-le-faire-cohabiter-avec-mysql-9708Q.html"; '; $tpl = str_replace($maPattern,$mareplace.$mareplacemenu,$tpl);scripts\wampserver.lib.php
Après la fonction checkMysqlConf, ajoutez cette fonction :
function checkMariaDBConf($baseDir,$version) { global $wampBinConfFiles; if (!is_file($baseDir.'/'.$version.'/'.$wampBinConfFiles)) return (0); return(1); }scripts\switchMariaDBVersion.php
Créez un nouveau fichier scripts\switchMariaDBVersion.php :
require 'wampserver.lib.php'; require 'config.inc.php'; $newMariaDBVersion = $_SERVER['argv'][1]; //on charge le fichier de conf de la nouvelle version require $c_mariadbVersionDir.'/mariadb'.$newMariaDBVersion.'/'.$wampBinConfFiles; $mariadbConf['mariadbVersion'] = $newMariaDBVersion; wampIniSet($configurationFile, $mariadbConf);
N'oubliez pas d'ajouter la balise <?php en début de fichier.
bin\mariadb\mariadb5.5.33a\my.iniPour la config du serveur MariaDB, j'ai utilisé la config medium, qui est celle utilisée par Wamp pour MySQL.
Les lignes surlignées sont celles que j'ai modifiées/ajoutées.
Créez un nouveau fichier bin\mariadb\mariadb5.5.33a\my.ini :
# Example MariaDB config file for medium systems. # # This is for a system with little memory (32M - 64M) where MariaDB plays # an important part, or systems up to 128M where MariaDB is used together with # other programs (such as a web server) # # MariaDB programs look for option files in a set of # locations which depend on the deployment platform. # You can copy this option file to one of those # locations. For information about these locations, do: # 'my_print_defaults --help' and see what is printed under # Default options are read from the following files in the given order: # More information at: http://dev.mysql.com/doc/mysql/en/option-files.html # # In this file, you can use all long options that a program supports. # If you want to know which options a program supports, run the program # with the "--help" option. # The following options will be passed to all MariaDB clients [client] #password = your_password port = 3307 socket = /tmp/mariadb.sock # Here follows entries for some specific programs # The MariaDB server [wampmariadb] port = 3307 socket = /tmp/mariadb.sock skip-external-locking key_buffer_size = 16M max_allowed_packet = 1M table_open_cache = 64 sort_buffer_size = 512K net_buffer_length = 8K read_buffer_size = 256K read_rnd_buffer_size = 512K myisam_sort_buffer_size = 8M basedir=C:/wamp/bin/mariadb/mariadb5.5.33a log-error=C:/wamp/logs/mariadb.log datadir=C:/wamp/bin/mariadb/mariadb5.5.33a/data # Point the following paths to different dedicated disks #tmpdir = /tmp/ # Don't listen on a TCP/IP port at all. This can be a security enhancement, # if all processes that need to connect to mysqld run on the same host. # All interaction with mysqld must be made via Unix sockets or named pipes. # Note that using this option without enabling named pipes on Windows # (via the "enable-named-pipe" option) will render mysqld useless! # #skip-networking # Replication Master Server (default) # binary logging is required for replication log-bin=mysql-bin # binary logging format - mixed recommended binlog_format=mixed # required unique id between 1 and 2^32 - 1 # defaults to 1 if master-host is not set # but will not function as a master if omitted server-id = 1 # Replication Slave (comment out master section to use this) # # To configure this host as a replication slave, you can choose between # two methods : # # 1) Use the CHANGE MASTER TO command (fully described in our manual) - # the syntax is: # # CHANGE MASTER TO MASTER_HOST=host, MASTER_PORT=port, # MASTER_USER=user, MASTER_PASSWORD=password ; # # where you replace host, user, password by quoted strings and # by the master's port number (3306 by default). # # Example: # # CHANGE MASTER TO MASTER_HOST='125.564.12.1', MASTER_PORT=3306, # MASTER_USER='joe', MASTER_PASSWORD='secret'; # # OR # # 2) Set the variables below. However, in case you choose this method, then # start replication for the first time (even unsuccessfully, for example # if you mistyped the password in master-password and the slave fails to # connect), the slave will create a master.info file, and any later # change in this file to the variables' values below will be ignored and # overridden by the content of the master.info file, unless you shutdown # the slave server, delete master.info and restart the slaver server. # For that reason, you may want to leave the lines below untouched # (commented) and instead use CHANGE MASTER TO (see above) # # required unique id between 2 and 2^32 - 1 # (and different from the master) # defaults to 2 if master-host is set # but will not function as a slave if omitted #server-id = 2 # # The replication master for this slave - required #master-host = hostname # # The username the slave will use for authentication when connecting # to the master - required #master-user = username # # The password the slave will authenticate with when connecting to # the master - required #master-password = password # # The port the master is listening on. # optional - defaults to 3306 #master-port = port # # binary logging - not required for slaves, but recommended #log-bin=mysql-bin # Point the following paths to different dedicated disks #tmpdir = /tmp/ #log-update = /path-to-dedicated-directory/hostname # Uncomment the following if you are using InnoDB tables #innodb_data_home_dir = C:\\mysql\\data\\ #innodb_data_file_path = ibdata1:10M:autoextend #innodb_log_group_home_dir = C:\\mysql\\data\\ #innodb_log_arch_dir = C:\\mysql\\data\\ # You can set .._buffer_pool_size up to 50 - 80 % # of RAM but beware of setting memory usage too high #innodb_buffer_pool_size = 16M #innodb_additional_mem_pool_size = 2M # Set .._log_file_size to 25 % of buffer pool size #innodb_log_file_size = 5M #innodb_log_buffer_size = 8M #innodb_flush_log_at_trx_commit = 1 #innodb_lock_wait_timeout = 50 [mysqldump] quick max_allowed_packet = 16M [mysql] no-auto-rehash # Remove the next comment character if you are not familiar with SQL #safe-updates [isamchk] key_buffer_size = 20M sort_buffer_size = 20M read_buffer = 2M write_buffer = 2M [myisamchk] key_buffer_size = 20M sort_buffer_size = 20M read_buffer = 2M write_buffer = 2M [mysqlhotcopy] interactive-timeout [mysqld] port=3307bin\mariadb\mariadb5.5.33a\wampserver.conf
Créez un nouveau fichier bin\mariadb\mariadb5.5.33a\wampserver.conf :
$mysqlConf['mariadbConfDir'] = '.'; $mysqlConf['mariadbConfFile'] = 'my.ini'; $mysqlConf['mariadbExeDir'] = 'bin'; $mysqlConf['mariadbExeFile'] = 'mysqld.exe'; $mysqlConf['mariadbServiceInstallParams'] = '--install-manual wampmariadb'; $mysqlConf['mariadbServiceRemoveParams'] = '--remove wampmariadb'; $mysqlConf['libMariaDBFile'] = 'bin/libmySQL.dll';
N'oubliez pas d'ajouter la balise <?php en début de fichier.
Aperçu des modificationsAprès avoir fait toutes ces modifications, lancez WampServer. Vous devriez avoir un nouvel élément dans le menu :
Vous pouvez voir que MariaDB est bien lancé en regardant les logs de MariaDB :
130925 14:44:31 InnoDB: The InnoDB memory heap is disabled 130925 14:44:31 InnoDB: Mutexes and rw_locks use Windows interlocked functions 130925 14:44:31 InnoDB: Compressed tables use zlib 1.2.3 130925 14:44:31 InnoDB: Initializing buffer pool, size = 128.0M 130925 14:44:31 InnoDB: Completed initialization of buffer pool 130925 14:44:31 InnoDB: highest supported file format is Barracuda. 130925 14:44:31 InnoDB: Waiting for the background threads to start 130925 14:44:32 Percona XtraDB (http://www.percona.com) 5.5.33a-MariaDB-31.1 started; log sequence number 1597945 130925 14:44:32 [Note] Plugin 'FEEDBACK' is disabled. 130925 14:44:32 [Note] Server socket created on IP: '::'. 130925 14:44:33 [Note] Event Scheduler: Loaded 0 events 130925 14:44:33 [Note] wampmariadb: ready for connections. Version: '5.5.33a-MariaDB-log' socket: '' port: 3307 mariadb.org binary distribution
J'ai mis intentionnellement le serveur sur le port 3307 car je souhaite travailler en parallèle avec MySQL.
Administration de MariaDB via phpMyAdminPour administrer le serveur MySQL et MariaDB on va utiliser phpMyAdmin.
Comme je vous l'ai dit, MariaDB est un fork de MySQL, il est donc tout à fait compatible avec phpMyAdmin.
On va ajouter un nouveau serveur à la configuration de phpMyAdmin.
Ouvrez le fichier apps\phpmyadmin4.0.5\config.inc.php (pour moi c'est la version 4.0.5)
Avant le commentaire :
/* * End of servers configuration */
Ajoutez :
/* * MariaDB server */ $i++; /* Authentication type */ $cfg['Servers'][$i]['auth_type'] = 'config'; /* Server parameters */ $cfg['Servers'][$i]['host'] = 'localhost'; $cfg['Servers'][$i]['port'] = '3307'; $cfg['Servers'][$i]['connect_type'] = 'tcp'; $cfg['Servers'][$i]['compress'] = false; /* Select mysql if your server does not have mysqli */ $cfg['Servers'][$i]['extension'] = 'mysqli'; $cfg['Servers'][$i]['AllowNoPassword'] = true; /* Autologin */ $cfg['Servers'][$i]['user'] = 'root'; $cfg['Servers'][$i]['password'] = '';
En allant sur phpmyadmin vous devriez avoir une liste déroulante avec la liste des serveurs :
Wamp PortableSuite à cet article, j'ai modifié mon script Wamp Portable pour y intégrer la gestion de MariaDB.
Bien entendu tout ceci pourrait s'appliquer à n'importe quel serveur. Il faut seulement recoller les bons bouts
Voilà j'espère que ça vous servira