MySql change data path of each database - mysql

Is it possible to change the location/path/directory/folder of a specific database? I hope the answer is not "no".
I know that there is a "datadir" setting in
"X:\Program Files\MySQL\MySQL Server x.x\my.ini"
file in which I can change the path for all databases. However, I want some specific databases to be specific location.
Example, I want “sales” database to be in “C:\sales\db\” folder and “hr” database to be in “C:\hr\db” folder. (Please don’t suggest of placing them in “C:\db\sales” and “C:\db\hr” folder respectively).
If it helps: I’m running MySql 5.1 under Windows XP SP3. I’m used to MS SQL Server’s ability to place database files on (restore to or attach from) user-specify location. I’m new to MySql.
Thanx in advance.

I found this answer using symbolic link... Maybe this help to you..
http://dev.mysql.com/doc/refman/5.0/en/symbolic-links.html

Related

Where can I find my mySQL database (using locate doesn't help)?

First ever Stack Overflow post, thanks for your time. Any constructive criticism on how to post better, please just let me know. I have done a search on my query and have found similar posts, but I was unable to use the information within them to resolve my problem.
I have created a mysql database using the terminal window in my Ubuntu system (which I am also new to, having been a lifelong windows user). I used the following code in the terminal window:
$ mysql -u root -p
Then once in mysql, I did the following
CREATE DATABASE securities_master;
USE securities_master;
I created a user and tables in the database using some other code, that doesn't seem relevant here, so I won't bother posting. However, I then decided I would like to take a look at the tables in the database, so I downloaded an SQLite browser. It was at this point that I realized I could not find my database file.
I tried to find the answer on previous stack overflow posts, and tried the suggestions of:
locate sqlite
locate .db
locate .sqlite
locate securities_master
But unfortunately, none of these showed the file I was looking for. The only place I can think of would be what is called the 'root' directory in my computer, but the Ubuntu file manager system won't let me view it because it says I don't have permissions. Is this where it might be?
Could someone shed some light on where I might be able to find this file/database? I know it is definitely there because if I try to CREATE it again, I get the message that it can't because it already exists.
Thanks again.
sqlite and mysql are two different databases. You can't use sqlite on a mysql database. sqlite is a single-file database, in which users just open the file and read and write to it, while mysql is a more traditional relational database system with a server and a client, where the server manages the database (which is generally in a directory of files), while the client just connects to the server.
Where the mysql database is located my depend on your system, but it's usually in /var/lib/mysql. You can look in /etc/mysql/my.cnf for the configuration file, which should have a datadir option that refers to where the actual data for the database is stored.
You can check my.ini file to see where the data folder is located.
Usually there is a folder {mysqlDirectory}/data
MySQL data storage:
Commands.frm
Commands.myd
Commands.myi
The *.frm files contain the table definitions. Your *.myi files are MyISAM index files. Your *.myd files contain the table data.
as mentioned in the answer before mine, mysql and sqlite are two different systems.
You mention you used the cmd line mysql to create the database and then wanted to view the tables. If you're simply trying to see which table are created, in the same command line you used to Create the database you can run show tables;
If you're after a GUI for this, we'd need a bit more context. Is this ubuntu system a remote server, or are you using the desktop version?
You say you're a long time windows user, If you're using windows locally, I personally like SQLWorkbench for accessing my remote mysql servers.
EDIT: I just re-read your post and realised you're using local ubuntu desktop so me mentioning remote was silly, my bad! However, SQLWorkbench does have a ubuntu version at https://dev.mysql.com/downloads/workbench/

Where is the database for Drupal 7

I' am on the learning process of Drupal 7. When installing Drupal 7 I have used MySQLI database option, where it didn't ask me any information about my database. After installation was complete. I went to my Database to check if database was automatically created, it wasn't.
I wanted to know where and how does Drupal 7 uses database.
Drupal configuration files is normally located in:
sites/default/settings.php
Which gets populated during installation process (usually copied from default.settings.php). In regards to the database - you need to create one beforehand (if you start a new project). Please, refer to INSTALL.txt in the root of Drupal package. There is a step-by-step instruction that explains the process.
Hope it helps.
If it successfully installed there sure must be a database somewhere :) When you install Drupal 7 it will determine what database types you have available and require you to input at least the database TYPE, and NAME.
If this information was not asked of you during the installation process then there is only one thing that I can think of; the settings file already has some database settings in there.
So I suggest looking in the place already mentioned:
/yourdrupalfolder/sites/default/settings.php
And have a hunt for an array that contains all the database information.
Hopefully that file will let you understand what happened!

How to copy mysql database file to your project folder?

Hi Friends I'm new to mysql but i know how to create user,database, table etc.
Earlier i use to work with ms access as backend. In ms access i had .*mdb file which i can put in my project folder and give it to anybody, so that the user can use my application without worrying about database.
but in MySQL i don't know how to copy database file and put in my project folder so that i can give it to other. and they can use my application without any worries......
plz help.... tell me if i'm wrong in my concept.....
Thanks in advance :))
You use mysqldump to dump the structure and contents of the database into a file, and then give that to the other person to load into their database server.

Dreamweaver/MyBB/MySQl Database?

I have MyBB installed on my server and apparently the template sets are stored via MySQL database instead of downloaded to the remote server. I would like to set up a path in Dreamweaver so I can directly edit template sets without having to go into the acp in MyBB. Otherwise, there's really no way to test locally unless I set up a database on my machine and it wouldn't make sense having two databases with the same entries. Has anyone managed to set up an ftp path through Dreamweaver that will link to a MySQL database, or is this not possible? Thanks in advance.
Has anyone managed to set up an ftp path through Dreamweaver that will
link to a MySQL database, or is this not possible?
Not possible. Dreamweaver will let you create a connection to a MySQL database to query it but you cannot affect the database structure from within Dreamweaver's interface.

mysql - how do I load data from a different configuration

I'm not sure if this will make sense, but I'll give it a shot.
My hard drive went down and I had to reinstall the os along with all my webserver configuration,etc. I kept a backup of the mysql database, but it doesn't contain all the tables...I added a couple tables after my last backup.
I have access to the hard drive and the directory where the mysql data files are stored from the failed hard drive, but I don't know how to retrieve the data into my new mysql database. Is it even possible to get the raw data files from mysql and load them into a different instance? I'd even be happy if there was some way for phpmyadmin to show the data files, then I could dump out to a backup txt file, and reload them into my new configuration.
Any help will be appreciated. thanks.
well, bad news...I can't access the drive anymore. As I tried to copy the files the drive went totally down. So, I'll just redo the couple tables. Thanks for your help anyway.
Although not recommended or reliable, it is possible to simply copy the data without using mysqldump. It might help if MySQL was shut down in a controlled manner (which does not appear to be the case) and the source and target environments are as similar as possible in terms of lib and MySQL versions.
The datafiles should be compatible - you can copy the data directory to ubuntu, and edit the /etc/mysql/my.cnf to point to the new directory.
The only catch might be where ubuntu being case sensitive effects the tables.