Location of database tables - MySQL - Windows XP - mysql

All,
This is the first time I am using MySQL and hence listing all the steps. This is actually a reinstall of MySQL since my 1st attempt had failed.
I have installed the latest version of MySQL Community Server on my machine. The installation folder is C:\Program Files\MySQL\MySQL Server 5.5 . The data folder resides in this folder path itself. I have created few tables in the MySQL command prompt by:
1 > Going into MS DOS Prompt.
2 > Making C:\Program Files\MySQL\MySQL Server 5.5 as my current directory
3 > Entered command: mysql -u root -p
4 > Entered password
5 > Placed my script file(.sql) which creates new tables in the folder C:\Program Files\MySQL\MySQL Server 5.5\bin
6 > In the command prompt, typed source <scriptfile>.sql
7 > Now, I get warnings for few tables. But when I enter command SHOW TABLES, all the tables in the script file are shown.
However, I am not able to locate the tables created in form of directories/files on the drive. The data folder does not contain my tables as well.Can anyone please tell me where are the tables located?

On Windows 7, the data directory is, by default, "C:/ProgramData/MySQL/MySQL Server 5.5/Data/". Note that "C:/ProgramData" is a hidden directory.

In windows 8(dont check in other OS)
Enter mysql in command prompt by
mysql -uusername -ppassword
Then type
select ##datadir;
mysql> select ##datadir;
+---------------------------------------------+
| ##datadir |
+---------------------------------------------+
| C:\ProgramData\MySQL\MySQL Server 5.6\data\ |
+---------------------------------------------+
1 row in set (0.00 sec)
Another way!!!
Go to C:\ProgramData\MySQL\MySQL Server 5.6\my.ini and there you can find datadir.
Be sure it is in ProgramData, not in ProgramFiles.

Go into your C:\Program Files\MySQL\MySQL Server 5.5\my.ini and find the variable "datadir".
This is your Data dir ;)

the table files are located in the \data folder. if you have not overriden this path when you were installing or if you have not modified the path in the my.ini config file after the installation. there are gui tools available for mysql that can help you do things easily.

C:/Documents and Settings/All Users/Application Data/MySQL/MySQL Server 5.1/Data/
Is the default DATA directory in XP.

Related

install mysql keyring plugin

I was trying to install keyring plugin on MySQL 5.7.18.
I edited my.ini file. It was blank so I added the following text and restarted MySQL.
[mysqld]
early-plugin-load=keyring_file.dll
I ran the following command to install the plugin.
mysql> install plugin keyring_file soname 'keyring_file.dll';
I then ran the following sql to check:
mysql> SELECT PLUGIN_NAME, PLUGIN_STATUS
-> FROM INFORMATION_SCHEMA.PLUGINS
-> WHERE PLUGIN_NAME LIKE 'keyring%';
+--------------+---------------+
| PLUGIN_NAME | PLUGIN_STATUS |
+--------------+---------------+
| keyring_file | ACTIVE |
+--------------+---------------+
1 row in set (0.00 sec)
But when I tried to alter a table to use encryption, I got errors.
mysql> ALTER TABLE t1 ENCRYPTION='Y';
ERROR 3185 (HY000): Can't find master key from keyring, please check keyring
plugin is loaded.
Did I miss a step somewhere?
Harriett, do the following:
Check the user that the MySQL service runs as (e.g., NETWORK SERVICE)
Create a keyring folder in C:/Program Files/MySQL/MySQL Server 5.7
Explicitly grant the MySQL service user permissions on the keyring folder
By default on Windows when using keyring_file, the keyring file is stored in C:/Program Files/MySQL/MySQL Server 5.7/keyring/keyring (I determined this by running SHOW VARIABLES LIKE 'keyring%' after installing the plugin and confirming its loading as you described).
After creating the keyring folder in C:/Program Files/MySQL/MySQL Server 5.7 right-click, then Properties -> Security, then Edit -> Add etc. Once the user is added check "Modify" in addition to Read & execute, List folder contents, Read and Write.
Then restart the MySQL service and you should be able to create an encrypted table without error.
NOTE: For security reasons you should go back and remove all users/groups you don't think will absolutely need to have access to the keyring folder (e.g., local machine users). On Unix the docs recommend that the mysql user and group alone have access to the folder.
On windows you don't need this line:
mysql> install plugin keyring_file soname 'keyring_file.dll';
that's the install operation for Linux (maybe you might if running under Node?)
BUT make sure you have a FULL install of MySql - I didn't realise there are cut down versions that don't have the plugin dlls (and other stuff).
And make sure you have the keyring_udf.dll installed and you've also created the UDF functions.
The documentation on mySql's pages for all this is badly organised and hard to follow.
This is one of those tasks that goes on for ever.. got key set up, got everything running - keyfile gets encrypted.
Then I use ALTER TABLE mytable ENCRYPTION='Y' but nothing happens.
I export the table and the export states "ENCRYPTION='Y'" but nope it's not encrypted. No error messages in mysql log, nothing.
I was facing the exact same issue on m local MySQL instance and following steps helped me resolve the ‘Encryption can't find master key, please check the keyring plugin is loaded.' issue.
Add following line in my.ini file
early-plugin-load=keyring_file.dll
Create a folder named keyring at C:\Program Files\MySQL\MySQL Server 8.0 location.
Grant modify access to this folder as MySQL needs to read the folder and insert keyring in the folder.
Also Grant modify access to MySQL folder inside Program Files.
Uninstall existing installed keyring plugin using following command -
UNINSTALL PLUGIN keyring_file;
Restart the MySQL server after making above changes.
Check if the keyring plugin is loaded or not using the following command :-
show variables like '%keyring%';
It should show an output like this :-
+--------------------+---------------------------------------------------------+
| Variable_name | Value |
+--------------------+---------------------------------------------------------+
| keyring_file_data | C:/Program Files/MySQL/MySQL Server 8.0/keyring\keyring |
| keyring_operations | ON |
+--------------------+---------------------------------------------------------+
2 rows in set (0.0024 sec)
Now you should be able to enable encryption on your table using this command :-
ALTER TABLE city ENCRYPTION='Y';
I hope the answer helps.
Check for my.ini file in "C:\Program Files\MySQL\MySQL Server 8.0"
if not available create my.ini file and add the below lines
[mysqld]
early-plugin-load=keyring_file.dll
grant read,write,execute,modify permissions to MYSQL folder and its internal folders in "C:\Program Files\MYSQL"
Restart your MYSQL80 service.
once you have restarted the service you should be able to see the "keyring" file in the default location
C:\Program Files\MySQL\MySQL Server 8.0\keyring
Note: keyring file will be in keyring folder i.e.,
C:\Program Files\MySQL\MySQL Server 8.0\keyring\keyring
if you don't find the file try to restart your system. In my case after restarting my system, i am able to see the files.
Now open mysql command line and execute below command
install plugin keyring_file soname 'keyring_file.dll';
Result :
Query OK, 0 rows affected (0.03 sec)
Now you can run the below command to see the keyring details.
SELECT PLUGIN_NAME, PLUGIN_STATUS FROM INFORMATION_SCHEMA.PLUGINS WHERE PLUGIN_NAME LIKE 'keyring%';
Result:
keyring_file_data C:/Program Files/MySQL/MySQL Server 8.0/keyring\keyring
keyring_operations ON
Now create your table with Encryption
ex:
CREATE TABLE dept ( deptno int NOT NULL
> AUTO_INCREMENT, dname varchar(20) , loc
> varchar(20) , CONSTRAINT pk_dept PRIMARY KEY ( deptno ) )
> engine=InnoDB ENCRYPTION = 'Y';
i think everything is wonderful as mentioned above, but a small change can run your tables.
use this.
ALTER TABLE t1 ENCRYPTION='N';
i will see you around.

MySQl Configuration Error After reinstall it

When I reinstall MySQL database after uninstall it, I got this error when configuration:
Error 1045
Now, My new directory is here:
E:\Program Files (x86)\MySQL\MySQL Server 5.5
and my old directory was this:
c:\Program Files (x86)\MySQL\MySQL Server 5.5
I delete whole MySQl folder on drive c , But it has error when want to config!
How can i fix this problem?
Thanks is advance.
You can follow this method as well:
Menu>Start>Run>CMD
"C:\Program Files\MySQL\MySQL Server 5.1\bin\mysqld.exe" --skip-grant-tables
Let's this window open and open a new one
Menu>Start>Run>CMD
"C:\Program Files\MySQL\MySQL Server 5.1\bin\mysql.exe" -u root
You're now connect to MySQL, you have to modified the root account in the date of MySQL
mysql> use mysql;
mysql> UPDATE user SET password=PASSWORD('motdepasse') WHERE user="root";
mysql> flush privileges;
mysql> exit;
Restart with MySQL Command Line Client
That's it
You should delete the data directory and then retry to install it, it should be in:
C:\Documents and Settings\All Users\Application Data\MySQL\MySQL Server 5.5\data
As mentioned on the last paragraph of your screenshot:
If you are re-installing after you just uninstalled the MySQL server please note that the data directory was not removed automatically. Therefore the old password from your last installation is still needed to connect to the server. In this case please select skip now and re-run the Configuration Window from the start menu.
Your solution:
1. "Add or Remove Programs
2. Deleted c:\mysql
3. Rebooted the PC
4. Reinstalled MySQL

Unable to locate ft_min_word_len variable in my local mysql server

I was trying to edit the MySQL server variable ft_min_word_len, but unfortunately i could not find the file location on my hard disk containing these settings
I looked for the files my.ini and my.cnf in MySQL installation directory, in c:\windows directory and in 'C:\ProgramData\MySQL\MySQL Server 5.5\' server 5.5 and any other possible location.
I found only one file my.ini in MySQL installation directory (c:\MySQL), but this file contains no such settings.
I look through phpmyadmin and i found that variable in 'Server variables and settings' section, i also find this variable in information_schema under GLOBAL_VARIABLES table.
But i couldn't find it in any file on my windows 7 system which is 64bit and i have installed 64bit specific MySQL
one thing i also noticed that there was no file for information_schema in 'C:\ProgramData\MySQL\MySQL Server 5.5\data' but for other database there is corresponding file in it.
Hope for some helpful answer
MySQL config file would usually be found on Windows under C:\Windows\my.ini and on Linux under
/etc/my.cnf
If you doesn't get any below line into file and then you can add it, then restart your mysql server.
[mysqld]
ft_min_word_len = 3
It isn't mandatory to specify every single variable in the settings file. MySQL will use the hard-coded default values when you don't set a value. Just add a new line to the file.
As about file location, it should be in the base dir:
mysql> SELECT ##basedir;
+------------------------------------------+
| ##basedir |
+------------------------------------------+
| C:\Program Files\MySQL\MySQL Server 5.0\ |
+------------------------------------------+
1 row in set (0.00 sec)

MySql - trying to import a database, get message 'The system cannot find the file specified.'

I installed MySql 4.1(because that what is running on my server), I got a file that is a dump of my database. It is about 4.6 GB.
I put that file in same location as MySql.exe lives C:\Program Files\MySQL\MySQL Server 4.1\bin
Then I go to command line and type in:
mysql -h localhost -u root -p [database name] < mysqlDump.sql
I get message back 'The system cannot find the file specified.'
What file is it referring to? The mysqlDump.sql?
Even when I specify the full path to the mySqlDump.sql file, I get the same message.
mysql -h localhost -u root -p [database name] < C:\Program Files\MySQL\MySQL Server 4.1\bin\mysqlDump.sql
I'm running MySql 4.1 on Windows7
update found out my mistake. My folder was hiding file extensions. Somehow when I saved the file on my machine I gave it an extra .sql extension. So the file had a name of mysqlDump.sql.sql
You are probably not in the right directory when you make the call.
Go there:
cd "C:\Program Files\MySQL\MySQL Server 4.1\bin"
or specify the input file's absolute path:
mysql -h localhost -u root -p [database name] < "C:\Program Files\MySQL\MySQL Server 4.1\bin"
Use TAB key when you are starting typing mysqlDump... to ensure that your file is there and you have privileges for it.
Tab key in command line will complete filename or not.
This will give you some information if the file exists and if you have permissions to that file. Maybe it was created from other operating system user account and you have no read privileges.
I put that file in same location as MySql.exe lives C:\Program
Files\MySQL\MySQL Server 4.1\bin
This is not good idea, because regular operating system user accoung may have no privileges to write in Program Files directory.
To do it properly I would add C:\Program Files\MySQL\MySQL Server 4.1\bin to the PATH environment variable (link with howto). After you do this you will be able to run MySQL executable files from anywhere you want (like your desktop or documents folder for example) without messing around in Program Files. You can place your working file at location where you have all privileges and work on it from the command line.

Where do the MySQL database files reside for WAMP?

I'm just curious as I am beginning to learn PHP and MySQL, as to where the database and other files of MySQL reside on the hard drive. I have installed WAMP on a Windows XP SP2 platform.
Explore variables from the output of following command:
mysql> show variables like '%dir%';
Data directories for mysql database :
Generally,
Windows wamp setup : mysql/data
Linux (Ubuntu) : /var/lib/mysql
Configured Location: [ my.cnf configures it as datadir ]
Linux :
$ cat /etc/mysql/my.cnf | grep 'datadir'
Windows :
Open mysql/my.cnf (search for `datadir` )
From mysql prompt : ( mysql> ) [ PREFERRED WAY ]
mysql> show variable like 'datadir';
I suppose that covers pretty much all cases.
Usually in the /mysql/data directory of your WAMP installation. You'll recognize the location because every database has a folder with the same name there.
You can change the location of the data directory using the datadir setting in my.cnf. It is often moved elsewhere to ensure the data there gets backed up regularly.
I am not sure about WAMP, but if you install MySQL manually it should reside somewhere along the lines of this path:
C:\Program Files\MySQL\MySQL Server 5.1
Use the following to find the data directory using SQL console:
show variables like 'datadir'
If your on linux you can use:
sudo find / mysql | grep mysql
On Ubuntu it stores its database files in /var/lib/mysql
wamp/bin/mysql/mysqlx.x.x/data