[ubuntu]
MySQL is a widely used and fast SQL database server. It is a client/server implementation that consists of a server daemon (mysqld) and many different client programs/libraries.
If you want to install Mysql database server in Ubuntu check this tutorial.
What is Mysql Data Directory?
Mysql data directory is important part where all the mysql databases storage location.By default MySQL data default directory located in /var/lib/mysql.If you are running out of space in /var partition you need to move this to some other location.
Note:- This is only for advanced users and before moving default directory make a backup of your mysal databases.
Procedure to follow
Open the terminal
First you need to Stop MySQL using the following command
sudo /etc/init.d/mysql stop
Now Copy the existing data directory (default located in /var/lib/mysql) using the following command
sudo cp -R -p /var/lib/mysql /path/to/new/datadir
All you need are the data files, so delete the others with the command
sudo rm /path/to/new/datadir
Note:- You will get a message about not being able to delete some directories, but that's what you want.
Now edit the MySQL configuration file with the following command
gksu gedit /etc/mysql/my.cnf
Look for the entry for "datadir", and change the path (which should be "/var/lib/mysql") to the new data directory.
Important Note:-From Ubuntu 7.10 (Gutsy Gibbon) forward, Ubuntu uses some security software called AppArmor that specifies the areas of your filesystem applications are allowed to access. Unless you modify the AppArmor profile for MySQL, you'll never be able to restart MySQL with the new datadir location.
In the terminal, enter the command
sudo gedit /etc/apparmor.d/usr.sbin.mysqld
Copy the lines beginning with "/var/lib/mysql", comment out the originals with hash marks ("#"), and paste the lines below the originals.
Now change "/var/lib/mysql" in the two new lines with "/path/to/new/datadir". Save and close the file.
Restart the AppArmor profiles with the command
sudo /etc/init.d/apparmor reload
( sudo vim /etc/init/mysql.conf change /var/lib/mysql to your new path)
Restart MySQL with the command
sudo /etc/init.d/mysql restart
or
sudo start mysql
(if fails, try sudo chown -R mysql:mysql /path/to/new/datadir)
Now MySQL should start with no errors, and your data will be stored in the new data directory location.
分享到:
相关推荐
MySQL Connector/Net ...在项目中引用组件:MySql.Data.dll (记得复制到本地中选择为true / 或直接把MySql.Data.dll复制到debug文件夹下) 在代码中 using MySql.Data.MySqlClient; ......接下来这里就看你表演了。
MySQL.Data.EntityFrameworkCore,MySql.Data.EntityFramework,MySql.Data
Sqlguar的源码中对MySql.Data.dll 做了强引用,版本必须为6.2.1.0,否则会报错。NuGet中的是最新的,所以基本上不能用,会报错: 需要引用MySql.Data.dll,请在Nuget安装最新稳定版本,如果有版本兼容问题请先删除原有...
用于mysql8.0版本的MySql.Data.dll类库,直接引用使用
最新版的MySql.Data 连接mysql数据库时,需要用到,然后在代码中引入using MySql.Data.MySqlClient;
用于mysql8.0版本的MySql.Data.dll类库,直接引用使用
MySql.Data.dll 8.0.30最新版
MySql.Data.dll 6.9.9 用于远程访问Mysql数据库,MySql.Data.dll 6.9.9 用于远程访问Mysql数据库,
MySql.Data.Entit
mysql.data版本集合,用于解决 给定关键字不在字典中 的问题。
各版本Mysql.Data.dll官方整理,从版本1.0到版本6.9.8,包含各版本帮助文档和Samples,方便开发。
EF+MySql 数据库操作依赖资源包
MySql.Data 版本6.9.9.0
收集了mysql几乎所有版本的mysql.data.dll,该文件是.net访问mysql数据库必须的文件,版本如下: 5.1.5.0,6.4.3.0,6.4.3.0,6.4.3.0,5.1.5.0,5.1.5.0,5.1.5.0, 6.4.3.0,6.4.3.0,6.3.7.0,6.5.4.0,6.5.4.0,5.1.5.0,6.4....
MySql.Data.dll 6.4.4 for .net 4.0
MySql Data.dll .net2.0版本
CSharp操作Mysql数据库需要的动态库,包含多个版本的MySql.Data.dll下载。
在连接mysql数据库时,需要用到,然后在代码中引入using MySql.Data.MySqlClient;
mysql.data.dll v4.0 亲测 可用!!!