在ubuntu8.04上设置mysql的多端口服务时的安全问题
由于智能搜索的引擎版本问题,需要把mysql设置成多个端口服务,用shell脚本写了一个mysql.sh文件: mypath=`pwd` echo mypath=$mypath myfolder=$mypath/db myport=9000 sudo chown -R mysql:mysql $myfolder sudo /usr/sbin/mysqld --basedir=/usr --datadir=$myfolder --user=mysql --pid-file=$myfolder/mysqld.pid --skip-external-locking --port=$myport --socket=$myfolder/mysqld.sock --default-character-set=utf8 --character-set-server=utf8 & echo \"mysql -u root -P $myport -h 127.0.0.1\" 没想到运行失败。出现以下异常: 090216 00:40:03 Can't create test file /opt/mysql/ubuntu.lower-test 090216 00:40:03 Can't create test file /opt/mysql/ubuntu.lower-test 090216 00:40:03 InnoDB: Operating system error number 13 in a file operation. InnoDB: The error means mysqld does not have the access rights to InnoDB: the directory. InnoDB: File name ./ibdata1 InnoDB: File operation call: 'open'. InnoDB: Cannot continue operation. 试了多种方法,发现原因是在ubuntu的apparmor的安全设置上。 解决如下: 在/etc/apparmor.d/中找到usr.sbin.mysqld文件,在其中加入转移后数据目录的读写设置。重启apparmor,再尝试上面俩次失败的操作都可以正常启动了。 |