Herramientas de usuario

Herramientas del sitio


Barra lateral

notas:bases_de_datos:mysql

¡Esta es una revisión vieja del documento!


Task MySQL

MySQL y datos CSV

Importacion :

LOAD DATA LOCAL INFILE 'usuarios.csv'
INTO TABLE usuarios
FIELDS TERMINATED BY ','
ENCLOSED BY '"'
LINES TERMINATED BY '\n'
(nombre, pass, usuario);

Exportacion :

SELECT * FROM usuarios ORDER BY DATE DESC
INTO OUTFILE "usuarios.csv"
FIELDS TERMINATED BY ','
ENCLOSED BY '"'
LINES TERMINATED BY '\r\n';
mysql -u root -p  cdr -B -e  "select * from \`calldetails\` limit 2;" | sed 's/\t/","/g;s/^/"/;s/$/"/;s/\n//g'

Unix Time

SELECT * , FROM_UNIXTIME( `dateTimeOrigination` ) AS Fecha
FROM `calldetails`
WHERE `finalCalledPartyNumber` = '7420'
SELECT * , FROM_UNIXTIME( `dateTimeOrigination` ) AS fecha
FROM `calldetails`
WHERE `finalCalledPartyNumber` = ''
AND FROM_UNIXTIME( `dateTimeOrigination` ) LIKE '%'
ORDER BY fecha

MySQL y Wordpress

UPDATE wp_posts SET guid = REPLACE(guid, 'http://dominioviejo.com','http://dominionuevo.com');
UPDATE wp_posts SET post_content = REPLACE(post_content, 'http://dominioviejo.com', 'http://dominionuevo.com');
UPDATE wp_links SET link_url = REPLACE(link_url, 'http://dominioviejo.com', 'http://dominionuevo.com');
UPDATE wp_links SET link_image = REPLACE(link_image, 'http://dominioviejo.com', 'http://dominionuevo.com');
UPDATE wp_postmeta SET meta_value = REPLACE(meta_value, 'http://dominioviejo.com', 'http://dominionuevo.com');
UPDATE wp_usermeta SET meta_value = REPLACE(meta_value, 'http://dominioviejo.com', 'http://dominionuevo.com');
 
/*UPDATE wp_options SET option_value = replace(option_value, 'http://dominioviejo.com', 'http://dominionuevo.com') WHERE option_name = 'home' OR option_name = 'siteurl' OR option_name = 'widget_text' OR option_name = 'dashboard_widget_options';*/
UPDATE wp_options SET option_value = REPLACE(option_value, 'http://dominioviejo.com', 'http://dominionuevo.com');
notas/bases_de_datos/mysql.1418934504.txt.gz · Última modificación: 2014/12/18 18:28 por cayu