importing mysql file into access DB - mysql

i need to import a mysql file into my access db. how do i do this?
here's a sample of the mysql file:
*
MySQL Data Transfer
Source Host: 10.0.0.5
Source Database: jnetdata
Target Host: 10.0.0.5
Target Database: jnetdata
Date: 5/26/2009 12:27:33 PM
*/
SET FOREIGN_KEY_CHECKS=0;
-- ----------------------------
-- Table structure for chavrusas
-- ----------------------------
CREATE TABLE `chavrusas` (
`id` int(11) NOT NULL auto_increment,
`date_created` datetime default NULL,
`luser_id` int(11) default NULL,
`ruser_id` int(11) default NULL,
`luser_type` varchar(50) default NULL,
`ruser_type` varchar(50) default NULL,
`SessionDay` varchar(250) default NULL,
`SessionTime` datetime default NULL,
`WeeklyReminder` tinyint(1) NOT NULL default '0',
`reminder_phone` tinyint(1) NOT NULL default '0',
`calling_card` varchar(50) default NULL,
`active` tinyint(1) NOT NULL default '0',
`notes` mediumtext,
`ended` tinyint(1) NOT NULL default '0',
`end_date` datetime default NULL,
`initiated_by_student` tinyint(1) NOT NULL default '0',
`initiated_by_volunteer` tinyint(1) NOT NULL default '0',

directly from that file won't be easy. i suggest instead installing mysql and myodbc. once you have the database loaded in mysql, you can connect to the database in access using an ODBC linked table. from their you can either access the data directly and just use access as a front-end to the database, or you can create tables and copy the rows in to access.

Related

Wordpress MySQL wp_post export/ import

I'm trying to export an old wp_posts database into a new one, and I'm hitting a few brick walls.
I'm currently exporting in SQL compatibility mode: MYSQL40.
Here's the error:
--
-- Database: `grafiqe`
--
-- --------------------------------------------------------
--
-- Table structure for table `wp_actionscheduler_actions`
--
CREATE TABLE `wp_actionscheduler_actions` (
`action_id` bigint(20) UNSIGNED NOT NULL,
`hook` varchar(191) NOT NULL,
`status` varchar(20) NOT NULL,
`scheduled_date_gmt` datetime DEFAULT '0000-00-00 00:00:00',
`scheduled_date_local` datetime DEFAULT '0000-00-00 00:00:00',
`args` varchar(191) DEFAULT NULL,
`schedule` longtext,
`group_id` bigint(20) UNSIGNED NOT NULL DEFAULT '0',
`attempts` int(11) NOT NULL DEFAULT '0',
`last_attempt_gmt` datetime DEFAULT '0000-00-00 00:00:00',
`last_attempt_local` datetime DEFAULT '0000-00-00 00:00:00',
`claim_id` bigint(20) UNSIGNED NOT NULL DEFAULT '0',
`extended_args` varchar(8000) DEFAULT NULL
)
MySQL said: Documentation
#1050 - Table 'wp_actionscheduler_actions' already exists```
Your code snippet already tells you the error
#1050 - Table 'wp_actionscheduler_actions' already exists```
It's not possible to create a table with the name of a table that already exists in the database. Daft question, but are you importing it into the new empty database and not the same one you just exported it from?

Error importing into my database: ERROR 1146 (42S02) at line 217004: Table 'caol2.cao_curriculo' doesn't exist

I'm facing a weird issue while trying to import into my database.
The "root" user has all privileges
The database name is the same in phpmyadmin and in the .sql file (caol2)
The failing line is the following (217004):
CREATE ALGORITHM=UNDEFINED DEFINER=`root`#`localhost` SQL SECURITY DEFINER VIEW `caol2`.`cao_consulta_curriculo_por_vaga` AS (select `caol2`.`cao_curriculo`.`co_curriculo` AS `co_curriculo`,`caol2`.`cao_curriculo`.`ds_nome_profissional` AS `ds_nome_profissional`,`caol2`.`cao_curriculo`.`dt_nascimento` AS `dt_nascimento`,`caol2`.`cao_curriculo`.`nu_pretencao_salarial` AS `nu_pretencao_salarial`,`caol2`.`cao_curriculo`.`nu_dias_disponibilidade` AS `nu_dias_disponibilidade`,`caol2`.`cao_curriculo`.`co_estado` AS `co_estado`,`caol2`.`cao_uf`.`ds_uf` AS `ds_estado`,`caol2`.`cao_curriculo`.`co_cidade` AS `co_cidade`,`caol2`.`cao_cidade`.`no_cidade` AS `ds_cidade`,`caol2`.`cao_curriculo`.`conclusao_graduacao` AS `conclusao_graduacao`,`caol2`.`cao_curriculo`.`co_vaga_desejada` AS `co_vaga`,'1' AS `principal`,`caol2`.`cao_curriculo`.`dt_alteracao` AS `dt_alteracao`,`caol2`.`cao_vaga`.`co_escritorio` AS `co_escritorio`,`caol2`.`cao_curriculo`.`ds_email_contato` AS `ds_email_contato`,`caol2`.`cao_curriculo`.`status` AS `status` from (((`caol2`.`cao_curriculo` join `caol2`.`cao_vaga` on((`caol2`.`cao_curriculo`.`co_vaga_desejada` = `caol2`.`cao_vaga`.`co_vaga`))) join `caol2`.`cao_uf` on((`caol2`.`cao_curriculo`.`co_estado` = `caol2`.`cao_uf`.`co_uf`))) join `caol2`.`cao_cidade` on((`caol2`.`cao_cidade`.`co_cidade` = `caol2`.`cao_curriculo`.`co_cidade`)))) union (select `caol2`.`cao_curriculo`.`co_curriculo` AS `co_curriculo`,`caol2`.`cao_curriculo`.`ds_nome_profissional` AS `ds_nome_profissional`,`caol2`.`cao_curriculo`.`dt_nascimento` AS `dt_nascimento`,`caol2`.`cao_curriculo`.`nu_pretencao_salarial` AS `nu_pretencao_salarial`,`caol2`.`cao_curriculo`.`nu_dias_disponibilidade` AS `nu_dias_disponibilidade`,`caol2`.`cao_curriculo`.`co_estado` AS `co_estado`,`caol2`.`cao_uf`.`ds_uf` AS `ds_estado`,`caol2`.`cao_curriculo`.`co_cidade` AS `co_cidade`,`caol2`.`cao_cidade`.`no_cidade` AS `ds_cidade`,`caol2`.`cao_curriculo`.`conclusao_graduacao` AS `conclusao_graduacao`,`caol2`.`cao_vaga`.`co_vaga` AS `co_vaga`,'2' AS `principal`,`caol2`.`cao_curriculo`.`dt_alteracao` AS `dt_alteracao`,`caol2`.`cao_vaga`.`co_escritorio` AS `co_escritorio`,`caol2`.`cao_curriculo`.`ds_email_contato` AS `ds_email_contato`,`caol2`.`cao_curriculo`.`status` AS `status` from ((((`caol2`.`cao_curriculo` join `caol2`.`cao_curriculo_vaga` on(((`caol2`.`cao_curriculo`.`co_curriculo` = `caol2`.`cao_curriculo_vaga`.`co_curriculo`) and (`caol2`.`cao_curriculo`.`co_vaga_desejada` <> `caol2`.`cao_curriculo_vaga`.`co_vaga`)))) join `caol2`.`cao_vaga` on((`caol2`.`cao_vaga`.`co_vaga` = `caol2`.`cao_curriculo_vaga`.`co_vaga`))) join `caol2`.`cao_uf` on((`caol2`.`cao_curriculo`.`co_estado` = `caol2`.`cao_uf`.`co_uf`))) join `caol2`.`cao_cidade` on((`caol2`.`cao_cidade`.`co_cidade` = `caol2`.`cao_curriculo`.`co_cidade`))));
The "cao_curriculo" table is created at line 220234:
CREATE TABLE IF NOT EXISTS `cao_curriculo` (
`co_curriculo` int(6) NOT NULL AUTO_INCREMENT,
`linkedin` varchar(255) DEFAULT NULL,
`ds_nome_profissional` varchar(100) NOT NULL,
`dt_nascimento` date NOT NULL,
`nu_pretencao_salarial` decimal(7,2) DEFAULT NULL,
`nu_dias_disponibilidade` int(6) DEFAULT NULL,
`ds_graduacao` varchar(100) DEFAULT NULL,
`conclusao_graduacao` tinyint(1) DEFAULT NULL,
`ds_pos_graduacao` varchar(100) DEFAULT NULL,
`conclusao_pos` tinyint(1) DEFAULT NULL,
`co_estado` int(6) DEFAULT NULL,
`co_cidade` int(6) DEFAULT NULL,
`ds_impressao_entrevista_pessoal` text,
`ds_email_contato` varchar(100) NOT NULL,
`dt_alteracao` date NOT NULL,
`ds_bairro` varchar(100) DEFAULT NULL,
`co_vaga_desejada` varchar(255) NOT NULL,
`ds_foto` varchar(100) DEFAULT NULL,
`status` int(11) DEFAULT '0',
`sexo` char(2) DEFAULT NULL,
`exp_empresas` text,
`telefone` char(11) DEFAULT NULL,
`avaliacao` varchar(255) DEFAULT NULL COMMENT 'APROVADO, REPROVADO, CONTRATADO',
`aceita_freelance` varchar(1) DEFAULT NULL,
`disp_freelance` int(8) DEFAULT NULL,
PRIMARY KEY (`co_curriculo`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=2449 ;
The final result is just 32 of 158 tables imported.
I tried to import from phpmyadmin, and XAMPP mysql console, with same result.
Any help will be apreciated.
Thanks in advance.
Solved this issue by:
Exporting the database using MySQL workbench
Importing the .sql file using XAMPP MySQl shell

MySql - INSERT returns 0 rows affected

I'm trying to run the following command in the command line terminal of MySql, on my backup server:
Table Schema :
CREATE TABLE `cadveiculoequip` (
`idveiculoequip` VARCHAR(36) NOT NULL,
`idveiculo` VARCHAR(36) DEFAULT NULL,
`idequipamento` VARCHAR(36) DEFAULT NULL,
`datainstalacao` DATE DEFAULT NULL,
`datadesinstalacao` DATE DEFAULT NULL,
`idchkheader` VARCHAR(36) DEFAULT NULL,
`ID` INT(11) DEFAULT NULL,
`lastupdate` TIMESTAMP NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP,
`primario` INT(1) NOT NULL DEFAULT '1',
`mapeia_sombra` INT(1) DEFAULT '0',
`tec_responsavel` VARCHAR(100) DEFAULT NULL,
`km_rodado` VARCHAR(100) DEFAULT NULL,
`situacao` INT(2) DEFAULT NULL,
`teclado` VARCHAR(36) DEFAULT NULL,
`rfid` VARCHAR(36) DEFAULT NULL,
`idsatelite` VARCHAR(36) DEFAULT NULL,
`telemetria` VARCHAR(10) DEFAULT NULL,
`idosdes` VARCHAR(36) DEFAULT NULL,
PRIMARY KEY (`idveiculoequip`)
) ENGINE=INNODB DEFAULT CHARSET=utf8 AVG_ROW_LENGTH=129;
Query is :
INSERT INTO `cadveiculoequip` (`idveiculoequip`,`idveiculo`,`idequipamento`,`datainstalacao`,`datadesinstalacao`,`idchkheader`,`ID`,`lastupdate`,`primario`,`mapeia_sombra`,`tec_responsavel`,`km_rodado`,`situacao`,`teclado`,`rfid`,`idsatelite`,`telemetria`,`idosdes`)
VALUES ('IGORM','6788103A-8109-430C-A131-9FBBAF6D01F3','8abef011-c107-11df-b983-68b5558ab3e2','2018-02-21',NULL,'2CA923B6-60E9-42CF-BCFB-4BA238263079',4257329,'2018-02-21 08:44:51',1,0,'IGORM','0',1,NULL,NULL,NULL,'',NULL);
After execute the command, i just receive the message "0 rows affected".
Okay, so what's the problem..? I have executed the exactly same command in my development server (identical to backup server) the command has executed successfully, besides has returned "1 rows affected".
I discard the idea of ​​being a MySQL Error 1064.. Does anyone know what it could be?
(Sorry about the bad english, I'm kind of rusty... hehehe)
Edit:
Table 'cadveiculoequip'

How to create database in MySQL for import Maxmind GeoLite2 city csv

How to create database in MySQL for import Maxmind GeoLite2 city csv?
I need to know what types of fields I have to use and how properly connect the tables in the database to import from a csv-file.
This is my SQL-code example:
DROP TABLE IF EXISTS location;
CREATE TABLE IF NOT EXISTS `location` (
`geoname_id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`locale_code` varchar(2) DEFAULT NULL,
`continent_code` varchar(2) DEFAULT NULL,
`continent_name` varchar(20) DEFAULT NULL,
`country_iso_code` varchar(2) DEFAULT NULL,
`country_name` varchar(50) DEFAULT NULL,
`subdivision_1_iso_code` varchar(20) DEFAULT NULL,
`subdivision_1_name` varchar(70) DEFAULT NULL,
`subdivision_2_iso_code` varchar(20) DEFAULT NULL,
`subdivision_2_name` varchar(70) DEFAULT NULL,
`city_name` varchar(100) DEFAULT NULL,
`metro_code` int(11) DEFAULT NULL,
`time_zone` varchar(100) DEFAULT NULL,
PRIMARY KEY (`geoname_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
DROP TABLE IF EXISTS blocks_IPv4;
CREATE TABLE `blocks_IPv4` (
`network` varchar(30) DEFAULT NULL,
`geoname_id` int(11) DEFAULT NULL,
`registered_country_geoname_id` int(11) DEFAULT NULL,
`represented_country_geoname_id` int(11) DEFAULT NULL,
`is_anonymous_proxy` tinyint(1) DEFAULT '0',
`is_satellite_provider` tinyint(1) DEFAULT '0',
`postal_code` varchar(45) DEFAULT NULL,
`latitude` float DEFAULT NULL,
`longitude` float DEFAULT NULL,
`accuracy_radius` INT(5)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
DROP TABLE IF EXISTS blocks_IPv6;
CREATE TABLE `blocks_IPv6` (
`network` varchar(255) DEFAULT NULL,
`geoname_id` int(11) DEFAULT NULL,
`registered_country_geoname_id` int(11) DEFAULT NULL,
`represented_country_geoname_id` int(11) DEFAULT NULL,
`is_anonymous_proxy` tinyint(1) DEFAULT '0',
`is_satellite_provider` tinyint(1) DEFAULT '0',
`postal_code` varchar(45) DEFAULT NULL,
`latitude` float DEFAULT NULL,
`longitude` float DEFAULT NULL,
`accuracy_radius` INT(5)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
You can use my tool for converting MaxMind GeoLite2 country/city CSV to MySQL/PostgreSQL/Microsoft SQL Server 2019 from GitHub https://github.com/mbto/maxmind-geoip2-csv2sql-converter
You can read examples, or follow this steps:
Take a free license key to MaxMind API (if you don't have) at https://support.maxmind.com/account-faq/license-keys/how-do-i-generate-a-license-key/
Install Java 11 (if not installed) at adoptopenjdk.net or github.com/raphw/raphw.github.io or oracle.com/java
Download a tool from releases (.zip or .tar)
Unpack to yours directory
Copy/Paste .ini template bin/GeoLite2-City-CSV.mysql.default.ini with your profile name, example bin/GeoLite2-City-CSV.mysql.Your Project Name.ini or use default.
Open .ini template with Notepad and change [windows_loader] or [unix_loader] section (set MySQL host:port, user and password).
For unix: Execute chmod +x maxmind-geoip2-csv2sql-converter
Run converting: maxmind-geoip2-csv2sql-converter.bat -c "GeoLite2-City-CSV.mysql.Your Project Name.ini" -k Your_License_Key -i 4,6
After converting, the scripts bin/converted/loader.bat and bin/converted/loader.sh will be available.
For unix: Execute chmod +x loader.sh
Execute loader.bat or loader.sh for importing schemas.
Done

MySQL ucfirst doesn't work

I have this table:
CREATE TABLE IF NOT EXISTS `events` (
`evt_id` int(11) NOT NULL AUTO_INCREMENT,
`evt_name` varchar(50) CHARACTER SET utf8 NOT NULL DEFAULT 'ucfirst',
`evt_description` varchar(100) DEFAULT NULL,
`evt_startdate` date NOT NULL,
`evt_enddate` date DEFAULT NULL,
`evt_starttime` time DEFAULT NULL,
`evt_endtime` time DEFAULT NULL,
`evt_amtpersons` int(11) DEFAULT NULL,
`sts_id` int(11) NOT NULL,
`adr_id` int(11) DEFAULT NULL,
`evt_amtPersonsSubs` tinyint(4) NOT NULL DEFAULT '0',
`evt_photo` varchar(50) DEFAULT NULL,
`sys-mut-dt` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
`sys-mut-user` varchar(20) DEFAULT NULL,
`sys-mut-id` int(11) NOT NULL DEFAULT '0',
PRIMARY KEY (`evt_id`),
KEY `sts_id` (`sts_id`),
KEY `adr_id` (`adr_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=12 ;
But when I add in data into evt_name my first character is not capitalized. Any ideas?
Further information:
MySQL client version: 5.1.37
I want to do this in the database so that I don't have to do ucfirst with php always.
...what?
If I'm reading this right, it will just set the default value of evt_name to the string ucfirst. Try inserting a blank row and see if I'm reading that right.
If you're really against using ucfirst in PHP, you'll probably have to still call ucfirst every time in the query. Or you could only use ucfirst on display, and not in the database.
ucfirst is a function...you defined it as Default-Value for the cell. Use it like this:
INSERT INTO events SET evt_name = UCFIRST($value)