[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: comment adapter la syntaxe pour PgSQL



Merci beaucoup pour ces infos, je risque d'avoir le même problème bientôt avec JIRA.

Je suis encore en Debian 7 /Mysql, et JIRA indique ne pas supporter MariaDB (enfin que MariaDB est instable ou ne supporte pas bien un tas de fonctions .......).
Et ils recommandent mysql ou postgresql. Choix restreint si j'arrive à migrer en Debian 9

David

Le 17 janvier 2018 à 09:46, Bernard Schoenacker <bernard.schoenacker@free.fr> a écrit :


----- Mail original -----
> De: "Jean-Michel OLTRA" <jm.oltra.antispam@espinasse.net>
> À: debian-user-french@lists.debian.org
> Envoyé: Mercredi 17 Janvier 2018 00:24:42
> Objet: Re: comment adapter la syntaxe pour PgSQL
>
>
>     Bonjour,
>
>
> Le mardi 16 janvier 2018, Bernard Schoenacker a écrit...
>
>
> > mysql -u root -p
>
> su - postgres
>
> > mysql> CREATE USER 'postfix'@'localhost' IDENTIFIED BY
> > 'mot_de_passe';
>
> Perso, je crée un utilisateur ayant mon login (jm) et je me mets
> proprio
> (owner) de mes bases
>
> Toujours en user postgres :
>
> createuser -P bernard
> createuser --pwprompt --no-createdb --no-createrole --no-superuser
> postfix
> createdb --encoding=utf8 --owner=bernard postfix
>
> > mysql> GRANT USAGE ON * . * TO 'postfix'@'localhost' IDENTIFIED BY
> > 'mot_de_passe';
> > mysql> CREATE DATABASE `postfix` ;
> > mysql> GRANT ALL PRIVILEGES ON `postfix` . * TO
> > 'postfix'@'localhost';
> > mysql> FLUSH PRIVILEGES;
> > mysql> quit
>
> > //
> > CREATE USER 'postfix'@'localhost' IDENTIFIED BY  '***';
>
> > GRANT USAGE ON * . * TO  'postfix'@'localhost' IDENTIFIED BY  '***'
> > WITH MAX_QUERIES_PER_HOUR 0 MAX_CONNECTIONS_PER_HOUR 0
> > MAX_UPDATES_PER_HOUR 0 MAX_USER_CONNECTIONS 0 ;
>
> > GRANT ALL PRIVILEGES ON  `postfix` . * TO  'postfix'@'localhost';
>
> > // importer les tables postfix ou :
> > USE postfix;
> > CREATE TABLE `domaines` (
> >   `domaine` varchar(255) NOT NULL default '',
> >   `etat` tinyint(1) NOT NULL default '1',
> >   PRIMARY KEY  (`domaine`)
> > ) ENGINE=InnoDB;
> > CREATE TABLE `comptes` (
> >   `email` varchar(255) NOT NULL default '',
> >   `password` varchar(255) NOT NULL default '',
> >   `quota` int(10) NOT NULL default '0',
> >   `etat` tinyint(1) NOT NULL default '1',
> >   `imap` tinyint(1) NOT NULL default '1',
> >   `pop3` tinyint(1) NOT NULL default '1',
> >   PRIMARY KEY  (`email`)
> > ) ENGINE=InnoDB;
> > CREATE TABLE `alias` (
> >   `source` varchar(255) NOT NULL default '',
> >   `destination` text NOT NULL,
> >   `etat` tinyint(1) NOT NULL default '1',
> >   PRIMARY KEY  (`source`)
> > ) ENGINE=InnoDB;
>
> Si 'bernard' est propriétaire de la base, tu peux te connecter dessus
> avec :
> psql postfix
> puis
> postfix # grant select, update, delete, insert on domaines to
> postfix;
> postfix # grant select, update, delete, insert on comptes to postfix;
> postfix # grant select, update, delete, insert on alias to postfix;
>
> En fonction des nécessités, tu supprimes des droits dans ce que j'ai
> indiqué. Je suppose que postfix aura besoin du select. Mais du
> insert,
> update, delete ?
>
> Pour la création de table, je pense que c'est pareil, à part que tu
> évites
> le engine=InnoDB à la fin !
>
> > INSERT INTO `postfix`.`comptes` ( `email` , `password` , `quota` ,
> > `etat` , `imap` , `pop3` ) VALUES ('happy-tux@happy-tux.org',
> > ENCRYPT( 'mon_beau-mot-de-passe' ) , '0', '1', '1', '1');
>
> Il faut ajouter l'extension pgcrypto à la base.
>
> su - postgres
> psql postfix
> postfix= #create extension pgcrypto
>
> Mais le crypt() de postgresql prend un 'salt' en plus comme argument
> :
> select crypt('le-mot-de-passe', 'le-salt');
> Je ne sais pas si tu peux l'utiliser ?
>
> > service mysql reload
>
> service postgresql reload
>
> > INSERT INTO `postfix`.`alias` ( `source`, `destination`  , `etat` )
> > VALUES ('bernard.schoenacker@happy-tux.org',
> > 'happy-tux@happy-tux.org', '1');
>
> ok.
>
> Question bête: pourquoi vouloir passer de mariadb à postgres ?
>
> --
> jm
>


bonjour,

la doc officielle de mailman3 passe à pgSQL, et par conséquence
je bascule vers pgsql

slt
bernard




--
Salutations,
David CHALON

Reply to: