Import SQL problem na novom hostingu

Uzeo sam novi host i domen i naravno sve povezao kako treba,ali kada sam hteo da uvezem moj stari sajt pojavili se problemi.
Nikako ne mogu da ubacim SQL u novu bazu podataka.
Uvek izbacuje gresku.
Da li mogu nekako manuelno to da uradim?

Konkretno? Post must be at least 20 characters

1 Like

Mislim da moras prvo kreirati praznu bazu :innocent::innocent::innocent: ovako napamet. Sve ovisi kako si radio export.

Error

SQL query:

``

TRUNCATE TABLE `oc8m_address`

MySQL said: Documentation

#1146 - Table 'hiqclqjj_new.oc8m_address' doesn't exist

obriši taj truncate query iz sql fajla :smiley:

CREATE TABLE `oc8m_address` IF NOT EXISTS;
TRUNCATE TABLE `oc8m_address`;

dodaj ali pitanje je ostatka skripte odnosno kako će se skripta ponašati ako ne postoji.

Dodaj ovo pa da idemo na sljedeću grešku. :wink:

Edit: popravio.

Static analysis:

2 errors were found during analysis.

  1. Unexpected beginning of statement. (near “UNCATE” at position 0)
  2. Unrecognized statement type. (near “TABLE” at position 7)

SQL query:

UNCATE TABLE oc8m_addressIF EXISTS

MySQL said: Documentation

#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'UNCATE TABLEoc8m_addressIF EXISTS' at line 1

Stavi u sjedeći red i koristi backticks za naziv tabele >>>`<<<

CREATE TABLE `oc8m_address` IF NOT EXISTS; 
TRUNCATE TABLE `oc8m_address`;

Nisam bas vest u ovom sportu.
Ovako sam napravio

TRUNCATE TABLE oc8m_addressIF NOT EXISTS ;

INSERT INTO oc8m_address (address_id, customer_id, firstname, lastname, company, address_1, address_2, city, postcode, country_id, zone_id, custom_field) VALUES (‘1’, ‘1’, ‘Faiz’, ‘ali’, ‘Pakistan’, ‘A-14’, ‘Meezan bank near PSO pump malir Karachi Pakistan’, ‘Karachi’, ‘75080’, ‘162’, ‘2462’, ‘’);

TRUNCATE TABLE oc8m_addressIF NOT EXISTS;

INSERT INTO oc8m_api (api_id, username, key, status, date_added, date_modified) VALUES (‘1’, ‘Default’, ‘72UvtGRDeUObh2plKrpGTSqXbhjzFzgUavhwhaAbbUuK415ak4abUZhyLFN871wtaJHVz0R5HHaIuUuBpKzWsxkmcnCIHHj8j6XaZMb2CYlInMevSHtdNEkj0KiE7SiIBWX2O2FwTvAwXGHfFom8bzlMPZwrM2uhvY8mYG8ovAWFbYEc1rHV1FwmW9VZm7Ttz5SNFzzuya40Ib8nUEIZGktWBAhxz9zD9JudxHUOVws7z1C8gz3YssJx1IZgE3Dm’, ‘1’, ‘2018-05-18 13:05:44’, ‘2018-05-18 13:05:44’);

TRUNCATE TABLE oc8m_address;

CREATE TABLE >>>oc8m_address<<< IF NOT EXISTS;
TRUNCATE TABLE oc8m_address;

Ovako si treb’o

CREATE TABLE `oc8m_address` IF NOT EXISTS;
TRUNCATE TABLE `oc8m_address`;

INSERT INTO oc8m_address (address_id, customer_id, firstname, lastname, company, address_1, address_2, city, postcode, country_id, zone_id, custom_field) VALUES (‘1’, ‘1’, ‘Faiz’, ‘ali’, ‘Pakistan’, ‘A-14’, ‘Meezan bank near PSO pump malir Karachi Pakistan’, ‘Karachi’, ‘75080’, ‘162’, ‘2462’, ‘’);
INSERT INTO oc8m_api (api_id, username, key, status, date_added, date_modified) VALUES (‘1’, ‘Default’, ‘72UvtGRDeUObh2plKrpGTSqXbhjzFzgUavhwhaAbbUuK415ak4abUZhyLFN871wtaJHVz0R5HHaIuUuBpKzWsxkmcnCIHHj8j6XaZMb2CYlInMevSHtdNEkj0KiE7SiIBWX2O2FwTvAwXGHfFom8bzlMPZwrM2uhvY8mYG8ovAWFbYEc1rHV1FwmW9VZm7Ttz5SNFzzuya40Ib8nUEIZGktWBAhxz9zD9JudxHUOVws7z1C8gz3YssJx1IZgE3Dm’, ‘1’, ‘2018-05-18 13:05:44’, ‘2018-05-18 13:05:44’);

Mislim da treba mnogo toga da naucim
evo sad sam uradio kao ti i

Static analysis:

2 errors were found during analysis.

  1. Unexpected beginning of statement. (near “EATE” at position 0)
  2. Unrecognized statement type. (near “TABLE” at position 5)

SQL query:

EATE TABLE oc8m_address IF NOT EXISTS

MySQL said: Documentation

#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'EATE TABLEoc8m_addressIF NOT EXISTS' at line 1

Pa ne čita ti dobro ili si loše prekopir’o.
EATE bi trebalo biti CREATE.

Prepiši, nemoj kopirati: nekad wysiwyg editori znaju malo pobrljaviti (iako sam se trudio koristiti code tags).

Tako pise

Završio prethodnu komandnu linuju tačka-zarezom?
Ili je ovo što sam ti napis’o ujedno i sve što se trenutno nalazi u skripti?

Stavio sam
ovako je napisano u tom sql koji treba da uvezem
to je original koji nije editovan

TRUNCATE TABLE oc8m_address;

INSERT INTO oc8m_address (address_id, customer_id, firstname, lastname, company, address_1, address_2, city, postcode, country_id, zone_id, custom_field) VALUES (‘1’, ‘1’, ‘Faiz’, ‘ali’, ‘Pakistan’, ‘A-14’, ‘Meezan bank near PSO pump malir Karachi Pakistan’, ‘Karachi’, ‘75080’, ‘162’, ‘2462’, ‘’);

TRUNCATE TABLE oc8m_api;

INSERT INTO oc8m_api (api_id, username, key, status, date_added, date_modified) VALUES (‘1’, ‘Default’, ‘72UvtGRDeUObh2plKrpGTSqXbhjzFzgUavhwhaAbbUuK415ak4abUZhyLFN871wtaJHVz0R5HHaIuUuBpKzWsxkmcnCIHHj8j6XaZMb2CYlInMevSHtdNEkj0KiE7SiIBWX2O2FwTvAwXGHfFom8bzlMPZwrM2uhvY8mYG8ovAWFbYEc1rHV1FwmW9VZm7Ttz5SNFzzuya40Ib8nUEIZGktWBAhxz9zD9JudxHUOVws7z1C8gz3YssJx1IZgE3Dm’, ‘1’, ‘2018-05-18 13:05:44’, ‘2018-05-18 13:05:44’);

TRUNCATE TABLE oc8m_api_ip;

Hvala puno na vremenu i pomoci,ali ja nemam strpljenja vise.
Radije cu ponovo praviti sajt.

Nemozes insert u table ako table nije kreiran. A sto zapravo zelsi napraviti? Mozda ako vec razmisljas o kreiranju sitea iznova da probas dumpat cjelu bazu pa je importas cijelu jer onda vjerujemd a ce i creirat tablice a ne ovako da inserta u tablice koje ne postoje…

Sada si dod’o i oc8m_api_ip tabelu dole. Ja ti mogu pomoći samo sa onim što izneseš ovde jer se nagadjanjima ne bavim.

Ako se predomisliš, vrati se na ovu temu. :slight_smile:

Nisam dodao to je originalni sql koji nije editovan

Malo detaljnije,mozda i probam

Tebi je cilj da očistiš tabelu prije novog unosa. To radi TRUNCATE naredba.
TRUNCATE naredba cće ti vratiti grešku ako tabela koju planiraš da očistiš ne postoji u bazi.
Zbog toga komanda CREATE TABLE oc8m_address IF NOT EXISTS;
Ovde ćeš kreirati tabelu ukol’ko već ne postoji i naredna naredba neće imati problem jer će očistiti oc8m_address tabelu koja sad u svakom slučaju postoji (nije problem ni ako je sama tabela pred izvodjenje TRUNCATE naredbe već prazna).
Nakon toga vršiš unos podataka u tabelu i to bi trebalo biti to. Ni manje ni više.
Vidim da si naknadno stavio čišćenje oc8m_api_ip tabele (nije ga bilo u prvim postovima).

USE hiqclqjj_new;

CREATE TABLE `oc8m_address` IF NOT EXISTS;
TRUNCATE TABLE `oc8m_address`;

CREATE TABLE `oc8m_api_ip` IF NOT EXISTS;
TRUNCATE TABLE `oc8m_api_ip`;

CREATE TABLE `oc8m_api` IF NOT EXISTS;
TRUNCATE TABLE `oc8m_api`;

INSERT INTO oc8m_address (address_id, customer_id, firstname, lastname, company, address_1, address_2, city, postcode, country_id, zone_id, custom_field) VALUES (‘1’, ‘1’, ‘Faiz’, ‘ali’, ‘Pakistan’, ‘A-14’, ‘Meezan bank near PSO pump malir Karachi Pakistan’, ‘Karachi’, ‘75080’, ‘162’, ‘2462’, ‘’);
INSERT INTO oc8m_api (api_id, username, key, status, date_added, date_modified) VALUES (‘1’, ‘Default’, ‘72UvtGRDeUObh2plKrpGTSqXbhjzFzgUavhwhaAbbUuK415ak4abUZhyLFN871wtaJHVz0R5HHaIuUuBpKzWsxkmcnCIHHj8j6XaZMb2CYlInMevSHtdNEkj0KiE7SiIBWX2O2FwTvAwXGHfFom8bzlMPZwrM2uhvY8mYG8ovAWFbYEc1rHV1FwmW9VZm7Ttz5SNFzzuya40Ib8nUEIZGktWBAhxz9zD9JudxHUOVws7z1C8gz3YssJx1IZgE3Dm’, ‘1’, ‘2018-05-18 13:05:44’, ‘2018-05-18 13:05:44’);

Ovaj kod ti rješava sav problem (ako su polja address tabele i vrijednosti unosa korektno upisana):
setovana baza, napravljene i očišćene tabele koje trebaju biti očišćene te napravljen unos u address tabelu.
Ako ovo ne radi, nisam siguran da mogu pomoći s dostupnim podacima.

Edit: e sad je moguće da ne primjećuješ razliku izmedju api i api_ip tabela jer si ih izmiješ’o po postovima pa se postavlja pitanje da li su obe potrebne i [ako ne, ] koja od njih jeste.

2 Likes

Copyright © 2020 WM Forum - AboutContact - Sponsored by: Mydataknox & Profit Monkey