Déplacer un base de données mysql

Résolu/Fermé
Loading Messages postés 56 Date d'inscription vendredi 9 novembre 2007 Statut Membre Dernière intervention 24 décembre 2010 - 29 déc. 2007 à 17:20
Tiller Messages postés 781 Date d'inscription mercredi 4 juillet 2007 Statut Membre Dernière intervention 14 septembre 2008 - 29 déc. 2007 à 17:22
Bonjour,
Je viens de finir de developper mon premier site web. Mais je ne sais pas comment déplacer ma base de données créer en local vers un serveur. J'ai quand même essayé quelque chose en local, qui n'a pas marché. Je vous explique:
Avec phpmyadmin, j'ai fait une exportation et j'ai obtenue les lignes de code ci-dessous que j'ai mis dans un fichier BD.php

SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";

CREATE DATABASE IF NOT EXISTS 'mabase';
USE 'mabase';

CREATE TABLE IF NOT EXISTS `busi` (
`IdBusi` int(11) NOT NULL auto_increment,
`Nom` varchar(20) NOT NULL,
`Prenom` varchar(30) NOT NULL,
`Ville` varchar(20) NOT NULL,
`Tel` varchar(20) default NULL,
`Email` varchar(100) NOT NULL,
`Login` varchar(20) NOT NULL,
`MDP` varchar(100) NOT NULL,
`img_id` int(11) default NULL,
`IdPays` int(11) NOT NULL,
PRIMARY KEY (`IdBusi`),
KEY `img_id` (`img_id`),
KEY `IdPays` (`IdPays`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=5 ;

CREATE TABLE IF NOT EXISTS `devise` (
`IdDevise` int(11) NOT NULL auto_increment,
`Libelle` varchar(10) NOT NULL,
PRIMARY KEY (`IdDevise`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=4 ;

CREATE TABLE IF NOT EXISTS `etat` (
`IdEtat` int(11) NOT NULL auto_increment,
`Libelle` varchar(25) NOT NULL,
PRIMARY KEY (`IdEtat`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=4 ;


INSERT INTO `etat` (`IdEtat`, `Libelle`) VALUES
(1, 'Neuf'),
(3, 'Bon (Seconde main)');


CREATE TABLE IF NOT EXISTS `images` (
`img_id` int(11) NOT NULL auto_increment,
`img_nom` varchar(50) NOT NULL,
`img_taille` varchar(25) NOT NULL,
`img_type` varchar(25) NOT NULL,
`img_desc` varchar(100) NOT NULL,
`img_blob` blob NOT NULL,
PRIMARY KEY (`img_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;


CREATE TABLE IF NOT EXISTS `message` (
`IdMessage` int(11) NOT NULL auto_increment,
`Titre` varchar(50) default NULL,
`Libelle` varchar(500) NOT NULL,
`DateMsg` varchar(30) NOT NULL,
`Delai` int(11) NOT NULL,
`IdBusi` int(11) NOT NULL,
`IdEtat` int(11) NOT NULL,
`IdDevise` int(11) NOT NULL,
`img_id` int(11) default NULL,
`prix` int(11) NOT NULL,
PRIMARY KEY (`IdMessage`),
KEY `IdBusi` (`IdBusi`),
KEY `IdEtat` (`IdEtat`),
KEY `IdDevise` (`IdDevise`),
KEY `img_id` (`img_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=11 ;


INSERT INTO `message` (`IdMessage`, `Titre`, `Libelle`, `DateMsg`, `Delai`, `IdBusi`, `IdEtat`, `IdDevise`, `img_id`, `prix`) VALUES
(1, 'Clé USB à vendre', 'Clé usb 2Go de marque sony', 'Vendredi 21 2007', 10, 1, 1, 1, NULL, 2000),
(3, 'Disque dur sata', 'Disque dur sata de marque samsung', 'Vendredi 21 2007', 10, 2, 3, 2, NULL, 60),
(10, 'Graveur DVD', 'Graveur DVD Double couche 16x de marque LG', 'lundi 24 decembre 2007', 10, 1, 1, 1, NULL, 25000);


CREATE TABLE IF NOT EXISTS `messbusi` (
`IdMB` int(11) NOT NULL auto_increment,
`Objet` varchar(30) NOT NULL,
`Libelle` varchar(501) NOT NULL,
`DateMB` varchar(30) NOT NULL,
`Heure` varchar(10) NOT NULL,
`Etat` varchar(10) default NULL,
`Emetteur` varchar(100) default NULL,
`IdBusi` int(11) NOT NULL,
PRIMARY KEY (`IdMB`),
KEY `IdBusi` (`IdBusi`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=9 ;


CREATE TABLE IF NOT EXISTS `pays` (
`IdPays` int(11) NOT NULL auto_increment,
`Numero` varchar(3) NOT NULL,
`Libelle` varchar(20) NOT NULL,
PRIMARY KEY (`IdPays`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=4 ;


ALTER TABLE `busi`
ADD CONSTRAINT `busi_ibfk_1` FOREIGN KEY (`img_id`) REFERENCES `images` (`img_id`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `busi_ibfk_2` FOREIGN KEY (`IdPays`) REFERENCES `pays` (`IdPays`) ON DELETE CASCADE ON UPDATE CASCADE;


ALTER TABLE `message`
ADD CONSTRAINT `message_ibfk_1` FOREIGN KEY (`IdBusi`) REFERENCES `busi` (`IdBusi`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `message_ibfk_2` FOREIGN KEY (`IdEtat`) REFERENCES `etat` (`IdEtat`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `message_ibfk_3` FOREIGN KEY (`IdDevise`) REFERENCES `devise` (`IdDevise`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `message_ibfk_4` FOREIGN KEY (`img_id`) REFERENCES `images` (`img_id`) ON DELETE CASCADE ON UPDATE CASCADE;


ALTER TABLE `messbusi`
ADD CONSTRAINT `messbusi_ibfk_1` FOREIGN KEY (`IdBusi`) REFERENCES `busi` (`IdBusi`) ON DELETE CASCADE ON UPDATE CASCADE;


Puis j'ai inseré le fichier BD.php dans le fichier index.php avec un include. Mais ça ne marche pas à l'exécution.

Quelque pourrait il donc m'aider a installer ma base de données sur un serveur?

Merci d'avance

Informations supplémentaires
Serveur: localhost
Version du serveur: 5.0.45-Debian_1+lenny1-log
Version de PHP: 5.2.3-1+lenny1
phpMyAdmin 2.11.2.2deb1
Version du client MySQL: 5.0.45

1 réponse

Tiller Messages postés 781 Date d'inscription mercredi 4 juillet 2007 Statut Membre Dernière intervention 14 septembre 2008 210
29 déc. 2007 à 17:22
Tu enregistres ce que tu as exporter dans un fichier .txt
Tu vas sur le phpmyadmin de ton site et tu importes le fichier
Le PHP n'a rien a voir dans l'histoire
1