How to populate timezones table in mariadb - mariadb

I am using this function in maria db it returns null.
SELECT CONVERT_TZ('2016-01-01 12:00:00','GMT','Africa/Johannesburg');
I searched on google it tells me to populate tables in maria db. But I do not know how to populate timezones table in maria db I see maria db documentation but it not help me.
Please help me to populate table.

I assume the MariaDB documentation you found is: https://mariadb.com/kb/en/time-zones/#mysql-time-zone-tables. Referenced there are the bottom is:
There is a zip file containing an updated timezone SQL information on https://mirror.mariadb.org/zoneinfo/ than can be imported.
On Linux and Unix based systems the /usr/share/zoneinfo path contains all this information and the following will import this into the time zone tables:
mariadb-tzinfo-to-sql /usr/share/zoneinfo | mariadb -u root -p mysql

Related

how to migrate a gupta (SQLBase) database to MySQL (including data)

Im trying to migrate a Gupta DB to MySQL. I already have a script to create every Table (with indexes and comments) and views I need in MySQL (table-, view- and column-names as well as column-types are equal in gupta as well as MySQL). But now I cant figure out how to read data from the old SQLBase Database and "import it" into the new MySQL database.
i thought of reading the old data from SQLBase and writing it in a file to then read it somehow via MySQL to import it. the Problem here is that for some tables there are more than 1 million records which i can not lose a single one of....
You can ETL natively from Gupta 'SQLBase' very easily. But you need to read the manual appropriate for your SQLBase version here: Gupta SQLBase manuals ( all verions ) , specifically, you need to read the 'UNLOAD' command in the 'Language Reference' manual. But best advice is: Don't do it ! Upgrade to SQLBase v12.2 instead.

Import database MySQL File-Per-Table Tablespaces to Same Server

Is necessary copy a database within a single server. Was chosen way to "File-Per-Table Tablespaces to Another Server" as it is the fastest for large databases.
The official documentation states that the database name must be the same on the source server and the destination server.
What if the source server and the destination server - this is one and the same server?
Is there any way in order to be able to copy the database files from one database to another within a server quickly.
Or somehow a way to get "File-Per-Table Tablespaces to Another Server" to ignore the name of the database?
Info server: OS: MS Windows Server 2008
MySQL Server: MySQL 5.5 or MariaDB
Tables Type: InnoDB (if MariaDB - InnoDB plugin)
Portability Considerations for .ibd Files
When you move or copy .ibd files, the database directory name must be the same on the source and destination systems. The table definition stored in the InnoDB shared tablespace includes the database name. The transaction IDs and log sequence numbers stored in the tablespace files also differ between databases.
EDITED:
I would create the backup files as suggested in the method, but would also export the schema as create table statements. After the backup I would use the rename table command to move the existing files to another database. Then Iwould recreate the schema in mz current database using the create table statements and then would import back the namespace as described.

SilverStripe FulltextSearch causing database error

I'm following this tutorial:
https://www.cwp.govt.nz/guides/core-technical-documentation/framework/en/tutorials/4-site-search
I've finished the first step of adding FulltextSearchable::enable(); to mysite/_config.php. I then run the dev/build as suggested but instead of completing successfully, I get this error:
[User Error] Couldn't run query: ALTER TABLE "File" ADD fulltext
"SearchFields" ("Filename","Title","Content") The used table type
doesn't support FULLTEXT indexes
Google tells me that my MySQL database is in the incorrect format. However SilverStripe automatically generates a database for you. I could change the database format, but I don't think changing the database format is the correct approach here as other users appear to have the module working.
Any help would be appreciated.
As far as my memory serves me right SilverStripe creates the tables as InnoDB. MySQL 5.5 documentation says that FULLTEXT indexes are supported by MyISAM tables. InnoDB support for FULLTEXT indexes comes in 5.6.
Full-text indexes can be used only with MyISAM tables. (In MySQL 5.6 and up, they can also be used with InnoDB tables.)
You need to change your tables to MyISAM or update MySQL.
Here is a good guide for changing table types. In case the site goes down, here are the good points:
Steps to follow:
Take backup of Mysql database.
Run this sql query via terminal or in phpmyadmin for the database which you wish to convert into MYISAM.
mysql -u username -p -e "SELECT concat('ALTER TABLE ', TABLE_NAME,' ENGINE=MYISAM;') FROM Information_schema.TABLES WHERE TABLE_SCHEMA = 'db_name' AND ENGINE = 'InnoDB' AND TABLE_TYPE = 'BASE TABLE'" | tail -n+2 >> alter.sql
Note: Change db_name with your actual database name
Import that alter.sql file into INNODB database
EDIT: Of course you can only change those tables that need to be FULLTEXT indexed.

Copying transaction table data of from production environment to development in Oracle

I want to copy the transaction table data from production environment to development environment in Oracle 11i.
Currently, we are manually copying the data from production environment to development environment using "copy data to another schema" option in Toad. But, I want this to be done by programmatically or some options where in I need to specify the list of tables names to be copied, source environment and destination environment. Once I specified all the required details, it has to copy the data from production environment to development environment.If I do this I can avoid manual mistakes.
Please suggest the various option to accomplish the above task.
Note: I'm a beginner in Oracle as well as in Toad.
You can use Export then Import.
Table Exports/Imports
The TABLES parameter is used to specify the tables that are to be exported. The following is an example of the table export and import syntax.
expdp scott/tiger#db11g tables=TRANSACTION directory=TEST_DIR dumpfile=TRANSACTION.dmp logfile=expdpTRANSACTION.log
impdp scott/tiger#db11g tables=TRANSACTION directory=TEST_DIR dumpfile=TRANSACTION.dmp logfile=impdpTRANSACTION.log
Make sure your TEST_DIR exists, and is accessible.
Here you go with the docs.
Import
Export
Thanks Team for all your response,
I have created link to test db from development db and then selected the test db records from dev db and inserted into development db. Please share me is this approach is correct or share the scenario where this approach will fail.
In development db, I created a link to test db.
“CREATE PUBLIC DATABASE LINK TestDBLink
CONNECT TO userid IDENTIFIED BY pwd
USING servicename;”
Script to copy data from test to development environment,
TRUNCATE TABLE Table1;
TRUNCATE TABLE Table2;
TRUNCATE TABLE Table3;
INSERT INTO Table1
SELECT * FROM Table1#TestDBLink;
INSERT INTO Table2
SELECT * FROM Table2#TestDBLink;
INSERT INTO Table3
SELECT * FROM Table3#TestDBLink;
Thanks,
Prakash.

Accessing .sqlite db from phpmyadmin? FF cookies

I'm trying to view my firefox cookies db (cookies.sqlite). Since I've never accessed dbs with anything other than phpmyadmin, I'm at a loss as to how to view the content of this sqlite file. There's localhost/sqlitemanager, but I'd rather stick to the phpmyadmin interface that I'm used to.
Any ideas how I can open/view this sqlite db the normal way in phpmyadmin? Is it possible?
Thanks in advance
P.S. I know that browser cookies are very commonly accessed/played with. If you know another tool that's more specific for this goal, please drop me an answer or suggest in the comments.
There are also several web interfaces for sqlite.
phpSQLiteAdmin
SQLiteManager
Simple SQLite Manager
SQLite Admin
WizSQLiteAdmin
ezSqliteAdmin
SQLiteWebAdmin
knoda
I have not yet tried any of them - in fact, I found this SO question while researching sqlite web front-ends for my own use. But I, too, come from a phpMyAdmin background, so the first one I plan to try is phpSQLiteAdmin.
I imagine there are various GUI programs that will hold your hand. However, I'm going to show you what I would do if I was interested in table moz_cookies in db cookies.sqlite.
$
$ sqlite3 cookies.sqlite
SQLite version 3.5.9
Enter ".help" for instructions
sqlite> .schema
CREATE TABLE moz_cookies (id INTEGER PRIMARY KEY, name TEXT, value TEXT, host TEXT, path TEXT,expiry INTEGER, lastAccessed INTEGER, isSecure INTEGER, isHttpOnly INTEGER);
sqlite> select * from moz_cookies limit 1;
1248713741170186|PREF|ID=12d44375be9e7c86:U=d07dae1b87f4537c:LD=en:NR=100:TM=1248713740:LM=1254091506:FV=2:IG=3:S=Jdo_PXt92J5ojL6E|.google.com|/|1317163505|1255144201180851|0|0
sqlite>
You may want the sqlite3 CLI program. It is available on Unix and Windows.
SQLITE3(1) SQLITE3(1)
NAME
sqlite3 - A command line interface for SQLite version 3
SYNOPSIS
sqlite3 [options] [databasefile] [SQL]
SUMMARY
sqlite3 is a terminal-based front-end to the SQLite library that can
evaluate queries interactively and display the results in multiple for‐
mats. sqlite3 can also be used within shell scripts and other applica‐
tions to provide batch processing features.
DESCRIPTION
To start a sqlite3 interactive session, invoke the sqlite3 command and
optionally provide the name of a database file. If the database file
does not exist, it will be created. If the database file does exist,
it will be opened.
It has two categories of operations.
Commands intended directly for the interactive shell begin with .. Anything is an SQL query terminated as usual with ;.
Adminer is a PHPMyAdmin-like system that has support for MySQL, PostgreSQL, SQLite, MS SQL, Oracle, SimpleDB, Elasticsearch, MongoDB, etc.

Resources