Tags: mysql

Classer par : Date / Titre /

  1. il y a 1 mois par spirit
    Create a specific user for backups purpose with read-only permissions
    1. GRANT SHOW DATABASES, SELECT, LOCK TABLES, RELOAD ON *.* to backup@localhost IDENTIFIED BY 'password';
    2. FLUSH PRIVILEGES;
    Copier ceci sur votre site: <script type="text/javascript" src="http://www.posteet.com/embed/2082"></script>
  2. il y a 2 mois par macks
    binary
    1. SELECTFROM `table`  WHERE BINARY `COLUMN` = 'value'
    Copier ceci sur votre site: <script type="text/javascript" src="http://www.posteet.com/embed/2078"></script>
  3. il y a 2 mois par macks
    1. SELECT id,title INTO OUTFILE "c:/result.text"
    2. FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
    3. LINES TERMINATED BY "n"
    4. FROM property;
    Copier ceci sur votre site: <script type="text/javascript" src="http://www.posteet.com/embed/2074"></script>
  4. sponsorised links
  5. il y a 3 mois par spirit
    Il faut avoir un backup de base tel qu'il y ait un dossier par base de donnée, un fichier SQL compressé par table. "-P 4" désigne le nombre de core.
    1. find -print0 | xargs -0 -n 1 -P 4 -I {} sh -c "zcat '{}' | mysql mydatabase"
    Copier ceci sur votre site: <script type="text/javascript" src="http://www.posteet.com/embed/2071"></script>
  6. il y a 4 mois par spirit
    Scripted install of MySQL
    1. echo mysql-server mysql-server/root_password select PASSWORD | debconf-set-selections
    2. echo mysql-server mysql-server/root_password_again select PASSWORD | debconf-set-selections
    3.  
    4. aptitude -y install mysql-server libmysqlclient15-dev
    Copier ceci sur votre site: <script type="text/javascript" src="http://www.posteet.com/embed/2060"></script>
  7. il y a 4 mois par macks
    1. from django.db import load_backend, transaction, connection
    2.  
    3. #manipular datos de una bd externa
    4.  
    5. def sincronizeDB(self):
    6.         myBackend = load_backend('mysql') # or 'mysql', 'sqlite3', 'oracle'
    7.         myConnection = myBackend.DatabaseWrapper({
    8.             'DATABASE_HOST': '192.168.1.11',
    9.             'DATABASE_NAME': 'agenciaperu_local',
    10.             'DATABASE_OPTIONS': {},
    11.             'DATABASE_PASSWORD': "",
    12.             'DATABASE_PORT': "",
    13.             'DATABASE_USER': "root",})
    14.         # Now we can do all the standard raw sql stuff with myConnection.
    15.         myCursor = myConnection.cursor()       
    16.         id = 22
    17.         name = "tecnologia para jos"
    18.         slug = "tecnologia_para_jos"
    19.         row = myCursor.execute("INSERT INTO category(name, slug )  values(%s,%s);", [name, slug])
    20.         row = myConnection._commit()
    21.         #row = transaction.rollback_unless_managed()  -----> sería cuando trabajamos en local
    22.  
    23. # select simple
    24.         #row = myCursor.execute("select *from category where id = %s and highlight = %s;",[id,0])
    25.         myCursor.fetchall()
    Copier ceci sur votre site: <script type="text/javascript" src="http://www.posteet.com/embed/2056"></script>
  8. il y a 11 mois par macks
    1. #terminal
    2. C:\>mysql -uroot -p
    3. mysql> SELECT version();
    4.  
    5. # cliente mysql
    6. SELECT version();
    Copier ceci sur votre site: <script type="text/javascript" src="http://www.posteet.com/embed/1787"></script>
  9. il y a 11 mois par macks
    agregar una columna despues de otra
    1. ALTER TABLE media add COLUMN  status VARCHAR (20) after component
    Copier ceci sur votre site: <script type="text/javascript" src="http://www.posteet.com/embed/1780"></script>
  10. il y a 11 mois par macks
    1. #dump
    2. mysqldump -hlocalhost -uuser -ppassword nomdatabase> nomdatabase.sql
    3.  
    4. #restore
    5. mysql -hlocalhost -uuser -ppassword nomdatabase < nomdatabase
    Copier ceci sur votre site: <script type="text/javascript" src="http://www.posteet.com/embed/1775"></script>
  11. il y a 11 mois par macks
    a partir de mysql 5.0
    1. SELECT TIMESTAMPDIFF(DAY,'2005-01-02','2006-01-08');
    Copier ceci sur votre site: <script type="text/javascript" src="http://www.posteet.com/embed/1772"></script>

Première / Précédent / Suivant / Dernière / Page 1 sur 5 (48 posteets)