Page 1 of 2
Crear DB de MariaDB
Posted: Wed Nov 06, 2019 6:52 pm
by jorge.posadas
Grupo
¿Cómo puedo crear, desde mi aplicación, una base de datos en MariaDB, PEROOO en un directorio que yo desee?
De antemano muchas gracias
Re: Crear DB de MariaDB
Posted: Wed Nov 06, 2019 10:52 pm
by dragancesu
Easy or hard, it depends how you think
Best from some database management program, I use HeidiSQL
The principle is to create a database and tables that you use from the application
CREATE DATABASE [IF NOT EXISTS] database_name
[CHARACTER SET charset_name]
[COLLATE collation_name]
http://www.mysqltutorial.org/mysql-create-database/
CREATE TABLE [IF NOT EXISTS] table_name(
column_1_definition,
column_2_definition,
...,
table_constraints
) ENGINE=storage_engine;
http://www.mysqltutorial.org/mysql-create-table/
And forget the folder, the data is written to the database, and it is somewhere in the installation, like \ProgramData\MySQL\MYSQL Server x.x\data
and folders is database nama with data definition, but all data is in file ibdata1 if use InnoDB storage engine, recommanded
x.x = mysql version
Re: Crear DB de MariaDB
Posted: Wed Nov 06, 2019 10:57 pm
by dragancesu
The first step is to install the database software
The second step is to create a database and tables
Data is transmitted through export (result is file like dbname.sql), import is start export file ( dbname.sql )
Re: Crear DB de MariaDB
Posted: Thu Nov 07, 2019 2:22 am
by Ismach
Bueno crearlo es facil pero no podras levantarlo como servidor tan facilmente
porque necesitas reinciar y orientar el que es DATADIR al servidor, NO funciona como en DBFs
aqui hay un servidor o servicio que usa LOCATION --> DATADIR, mas alla de los privilegios de los usuarios
solo accede a las bases de datos que levante o se pase por parametros a "mysqld.exe"
Para cada servidor necesitas otientar DATADIR
Code: Select all
"datadir=C:/Mariadb/data" --> my.ini
Enel caso de que tengas varias Bases de Datos en distintos DATADIR solo tendras acceso a las Bases que esten en el directorio DATADIR
1) levantar elservidor y orientar aldirectorio donde quieras...:
Code: Select all
ccSQL :="C:/Mariadb/bin/mysqld --basedir=C:/Mariadb/" --datadir=C:/IsmaCh/dbLaNena/"
RUN (ccSQL)
2) ejecutar elscript .sql
Code: Select all
ccSQL :="C:/Mariadb/bin/mysql -h localhost -u root -p < C:/IsmaCh/dbLaNena/CreateMaridb.sql"
RUN (ccSQL)
Espero te Sirva
Saludos
Re: Crear DB de MariaDB
Posted: Thu Nov 07, 2019 8:17 am
by dragancesu
I see you know MySQL and how it works, i dont do that
I view MySQL as a server I access from the program, I don't care where the data is physically located (which can be easily seen)
For data preparation I use something simple, like Uniserver, create database and tables, then export and upload to server (thru HeidiSQL)
Uniserver is wapm server,
https://www.uniformserver.com/, start only MySQL service and work only like localhost
Re: Crear DB de MariaDB
Posted: Thu Nov 07, 2019 3:23 pm
by Ismach
El directorio default de MySQL Y Mariadb es \data\
pero eso se puede cambiar definitivamente o temporalmente
para ello solo hay que orientar el DATADIR
en mysql my.Ini en c:\mysql\bin\
en mariadb my.Ini pero en el directorio DATADIR default c:\mysql\data\
para reorientar el DATADIR se parametriza al momento de levantar o arrancar
el servidor mysqld.exe
en Mariadb es mas completo porque hay separacion de herramientas
INSTALLDB
INITDB
CREATEDB
STARTDB
en mysql es casi todo junto
Re: Crear DB de MariaDB
Posted: Thu Nov 07, 2019 8:59 pm
by Ismach
Re: Crear DB de MariaDB
Posted: Fri Nov 08, 2019 9:25 am
by mol
Is it possible to create portable installation of MariaDB?
Re: Crear DB de MariaDB
Posted: Fri Nov 08, 2019 1:01 pm
by Ismach
Re: Crear DB de MariaDB
Posted: Fri Nov 08, 2019 1:46 pm
by dragancesu
@mol
I don't know for MariaDB, for MySQL is
https://www.uniformserver.com/. It's variant WAMP server, I use and start only MySQL. Posssible make zip and unzip at another location. I don't try but be possible delete other programs apache, php, if not need
This is simple and useful for testing
@Ismach
You know mysql/mariadb but think about localhost and windows. MySQL/MariaDB is better, what if install on Linux? if the installation is on linux then forget about the folders and access to the files
Database management program is a better solution and works everywhere