dpkg:处理软件包 php5-mysql 时出错(--configure):

dpkg:处理软件包 php5-mysql 时出错(--configure):

安装 PHP 和 mySQL 时,出现以下错误信息。该怎么办?

Creating config file /etc/php5/mods-available/mysql.ini with new version
cp: cannot create regular file ‘/etc/php5/mods-available/mysql.ini’: No such      file or directory
dpkg: error processing package php5-mysql (--configure):
subprocess installed post-installation script returned error exit status 1
Processing triggers for libapache2-mod-php5 (5.5.9+dfsg-1ubuntu4.14) ...
Errors were encountered while processing: php5-mysql
E: Sub-process /usr/bin/dpkg returned an error code (1)

答案1

当我删除 mysql-server 并尝试重新安装时,发生了这种情况。我解决这个问题的方法是运行以下命令

sudo apt-get purge mysql-server mysql-client mysql-common mysql-client-5.5 mysql-server-5.5 mysql-client-5.6 mysql-server-5.6 
sudo apt-get autoremove
sudo apt-get autoclean

sudo rm -rf /etc/mysql

sudo apt-get install mysql-server mysql-common mysql-client
  • 链接装甲:

    sudo ln -s /etc/apparmor.d/usr.sbin.mysqld /etc/apparmor.d/disable/usr.sbin.mysqld

    sudo /etc/init.d/apparmor restart

  • 安装 MySQL 5.6:

    sudo apt-get install mysql-server-5.6

相关内容