- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
这是我现在在 Vagrant 中使用的。它适用于 mysql 5.5,但如果我尝试将其更改为 5.6,则会出现错误并且安装不正确。关于如何从 Vagrant 中的 shell 脚本安装 mysql-server-5.6 有什么建议吗?
这是我当前的 MySQL 5.5 脚本:
#! /usr/bin/env bash
# Variables
MYSERVERNAME=mywebsite.laravel
APPENV=local
DBHOST=localhost
DBNAME=dbname
DBUSER=dbuser
DBPASSWD=password
echo -e "\n--- Setting super user role... ---\n"
sudo su
echo -e "\n--- Mkay, installing now... ---\n"
echo -e "\n--- Updating packages list ---\n"
apt-get -qq update
echo -e "\n--- Install base packages ---\n"
apt-get -y install vim curl build-essential python-software-properties git > /dev/null 2>&1
echo -e "\n--- Add some repos to update our distro ---\n"
add-apt-repository ppa:ondrej/php5 > /dev/null 2>&1
add-apt-repository ppa:chris-lea/node.js > /dev/null 2>&1
echo -e "\n--- Updating packages list ---\n"
apt-get -qq update
echo -e "\n--- Install MySQL specific packages and settings ---\n"
echo "mysql-server mysql-server/root_password password $DBPASSWD" | debconf-set-selections
echo "mysql-server mysql-server/root_password_again password $DBPASSWD" | debconf-set-selections
echo "phpmyadmin phpmyadmin/dbconfig-install boolean true" | debconf-set-selections
echo "phpmyadmin phpmyadmin/app-password-confirm password $DBPASSWD" | debconf-set-selections
echo "phpmyadmin phpmyadmin/mysql/admin-pass password $DBPASSWD" | debconf-set-selections
echo "phpmyadmin phpmyadmin/mysql/app-pass password $DBPASSWD" | debconf-set-selections
echo "phpmyadmin phpmyadmin/reconfigure-webserver multiselect none" | debconf-set-selections
apt-get -y install mysql-server-5.5 phpmyadmin > /dev/null 2>&1
echo -e "\n--- Setting up our MySQL user and db ---\n"
mysql -uroot -p$DBPASSWD -e "CREATE DATABASE $DBNAME"
mysql -uroot -p$DBPASSWD -e "grant all privileges on $DBNAME.* to '$DBUSER'@'localhost' identified by '$DBPASSWD'"
echo -e "\n--- Installing PHP-specific packages ---\n"
apt-get -y install php5 apache2 libapache2-mod-php5 php5-curl php5-gd php5-mcrypt php5-mysql php-apc > /dev/null 2>&1
echo -e "\n--- Some additional packages for PHP module development and PhalconPHP compiling ---\n"
apt-get -y install php5-dev libpcre3-dev gcc make > /dev/null 2>&1
echo -e "\n--- Enabling mod-rewrite ---\n"
a2enmod rewrite > /dev/null 2>&1
echo -e "\n--- Allowing Apache override to all ---\n"
sed -i "s/AllowOverride None/AllowOverride All/g" /etc/apache2/apache2.conf
#echo -e "\n--- Setting document root to public directory ---\n"
#rm -rf /var/www
#ln -fs /vagrant/public /var/www
echo -e "\n--- We definitly need to see the PHP errors, turning them on ---\n"
sed -i "s/error_reporting = .*/error_reporting = E_ALL/" /etc/php5/apache2/php.ini
sed -i "s/display_errors = .*/display_errors = On/" /etc/php5/apache2/php.ini
echo -e "\n--- Turn off disabled pcntl functions so we can use Boris ---\n"
sed -i "s/disable_functions = .*//" /etc/php5/cli/php.ini
echo -e "\n--- Configure Apache to use phpmyadmin ---\n"
echo -e "\n\nListen 81\n" >> /etc/apache2/ports.conf
cat > /etc/apache2/conf-available/phpmyadmin.conf << "EOF"
<VirtualHost *:81>
ServerAdmin webmaster@localhost
DocumentRoot /usr/share/phpmyadmin
DirectoryIndex index.php
ErrorLog ${APACHE_LOG_DIR}/phpmyadmin-error.log
CustomLog ${APACHE_LOG_DIR}/phpmyadmin-access.log combined
</VirtualHost>
EOF
a2enconf phpmyadmin > /dev/null 2>&1
echo -e "\n--- Add environment variables to Apache ---\n"
cat > /etc/apache2/sites-enabled/000-default.conf <<EOF
<VirtualHost *:80>
DocumentRoot /var/www
ServerName $MYSERVERNAME
ErrorLog \${APACHE_LOG_DIR}/error.log
CustomLog \${APACHE_LOG_DIR}/access.log combined
SetEnv APP_ENV $APPENV
SetEnv DB_HOST $DBHOST
SetEnv DB_NAME $DBNAME
SetEnv DB_USER $DBUSER
SetEnv DB_PASS $DBPASSWD
</VirtualHost>
EOF
echo -e "\n--- Restarting Apache ---\n"
service apache2 restart > /dev/null 2>&1
echo -e "\n--- Installing Composer for PHP package management ---\n"
curl --silent https://getcomposer.org/installer | php > /dev/null 2>&1
mv composer.phar /usr/local/bin/composer
echo -e "\n--- Installing NodeJS and NPM ---\n"
apt-get -y install nodejs > /dev/null 2>&1
curl --silent https://npmjs.org/install.sh | sh > /dev/null 2>&1
echo -e "\n--- Installing javascript components ---\n"
npm install -g gulp bower > /dev/null 2>&1
echo -e "\n--- Updating project components and pulling latest versions ---\n"
cd /vagrant
sudo -u vagrant -H sh -c "composer install" > /dev/null 2>&1
cd /vagrant/client
sudo -u vagrant -H sh -c "npm install" > /dev/null 2>&1
sudo -u vagrant -H sh -c "bower install -s" > /dev/null 2>&1
sudo -u vagrant -H sh -c "gulp" > /dev/null 2>&1
echo -e "\n--- Creating a symlink for future phpunit use ---\n"
ln -fs /vagrant/vendor/bin/phpunit /usr/local/bin/phpunit
如何使其适用于 MySQL 5.6?
我尝试过改变:
apt-get -y install mysql-server-5.5 phpmyadmin > /dev/null 2>&1
至:
apt-get -y install mysql-server-5.6 phpmyadmin > /dev/null 2>&1
但是我收到了这个错误:
--- Setting up our MySQL user and db ---
==> default: Warning: Using a password on the command line interface can be insecure.
==> default: ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
==> default: Warning: Using a password on the command line interface can be insecure.
==> default: ERROR
==> default: 2002 (HY000)
==> default: : Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
==> default: --- Installing PHP-specific packages ---
知道如何正确安装 5.6 版本的 MySQL 吗?
更新:我已经尝试过(按照答案中的建议)
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install mysql-server-5.6
和
sudo apt-get update
sudo apt-get upgrade
一切正常,但最后一部分导致了这个:
$ sudo apt-get install mysql-server-5.6
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
mysql-client-5.6 mysql-client-core-5.6 mysql-common-5.6
mysql-server-core-5.6
Suggested packages:
mailx tinyca
The following packages will be REMOVED:
mysql-client-5.5 mysql-client-core-5.5 mysql-server-5.5
mysql-server-core-5.5
The following NEW packages will be installed:
mysql-client-5.6 mysql-client-core-5.6 mysql-common-5.6 mysql-server-5.6
mysql-server-core-5.6
0 upgraded, 5 newly installed, 4 to remove and 4 not upgraded.
Need to get 19.9 MB of archives.
After this operation, 69.6 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://archive.ubuntu.com/ubuntu/ trusty-updates/universe mysql-client-core-5.6 amd64 5.6.30-0ubuntu0.14.04.1 [4138 kB]
Get:2 http://archive.ubuntu.com/ubuntu/ trusty-updates/universe mysql-client-5.6 amd64 5.6.30-0ubuntu0.14.04.1 [5564 kB]
Get:3 http://archive.ubuntu.com/ubuntu/ trusty-updates/universe mysql-server-core-5.6 amd64 5.6.30-0ubuntu0.14.04.1 [4620 kB]
Get:4 http://archive.ubuntu.com/ubuntu/ trusty-updates/universe mysql-server-5.6 amd64 5.6.30-0ubuntu0.14.04.1 [5611 kB]
Get:5 http://archive.ubuntu.com/ubuntu/ trusty-updates/universe mysql-common-5.6 all 5.6.30-0ubuntu0.14.04.1 [13.4 kB]
Fetched 19.9 MB in 33s (597 kB/s)
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
LANGUAGE = (unset),
LC_ALL = (unset),
LC_MONETARY = "en_US.UTF-8",
LC_ADDRESS = "en_US.UTF-8",
LC_TELEPHONE = "en_US.UTF-8",
LC_NAME = "en_US.UTF-8",
LC_MEASUREMENT = "en_US.UTF-8",
LC_IDENTIFICATION = "en_US.UTF-8",
LC_NUMERIC = "en_US.UTF-8",
LC_PAPER = "en_US.UTF-8",
LANG = "en_US.UTF-8"
are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
locale: Cannot set LC_ALL to default locale: No such file or directory
Preconfiguring packages ...
(Reading database ... 73547 files and directories currently installed.)
Removing mysql-server-5.5 (5.5.49-0ubuntu0.14.04.1) ...
locale: Cannot set LC_ALL to default locale: No such file or directory
mysql stop/waiting
locale: Cannot set LC_ALL to default locale: No such file or directory
Removing mysql-client-5.5 (5.5.49-0ubuntu0.14.04.1) ...
Removing mysql-client-core-5.5 (5.5.49-0ubuntu0.14.04.1) ...
Removing mysql-server-core-5.5 (5.5.49-0ubuntu0.14.04.1) ...
Processing triggers for man-db (2.6.7.1-1ubuntu1) ...
Selecting previously unselected package mysql-client-core-5.6.
(Reading database ... 73327 files and directories currently installed.)
Preparing to unpack .../mysql-client-core-5.6_5.6.30-0ubuntu0.14.04.1_amd64.deb ...
Unpacking mysql-client-core-5.6 (5.6.30-0ubuntu0.14.04.1) ...
Selecting previously unselected package mysql-client-5.6.
Preparing to unpack .../mysql-client-5.6_5.6.30-0ubuntu0.14.04.1_amd64.deb ...
Unpacking mysql-client-5.6 (5.6.30-0ubuntu0.14.04.1) ...
Selecting previously unselected package mysql-server-core-5.6.
Preparing to unpack .../mysql-server-core-5.6_5.6.30-0ubuntu0.14.04.1_amd64.deb ...
Unpacking mysql-server-core-5.6 (5.6.30-0ubuntu0.14.04.1) ...
Selecting previously unselected package mysql-server-5.6.
Preparing to unpack .../mysql-server-5.6_5.6.30-0ubuntu0.14.04.1_amd64.deb ...
locale: Cannot set LC_ALL to default locale: No such file or directory
/usr/bin/locale: Cannot set LC_ALL to default locale: No such file or directory
Unpacking mysql-server-5.6 (5.6.30-0ubuntu0.14.04.1) ...
Selecting previously unselected package mysql-common-5.6.
Preparing to unpack .../mysql-common-5.6_5.6.30-0ubuntu0.14.04.1_all.deb ...
Unpacking mysql-common-5.6 (5.6.30-0ubuntu0.14.04.1) ...
Processing triggers for man-db (2.6.7.1-1ubuntu1) ...
Processing triggers for ureadahead (0.100.0-16) ...
Setting up mysql-client-core-5.6 (5.6.30-0ubuntu0.14.04.1) ...
Setting up mysql-client-5.6 (5.6.30-0ubuntu0.14.04.1) ...
Setting up mysql-server-core-5.6 (5.6.30-0ubuntu0.14.04.1) ...
Setting up mysql-server-5.6 (5.6.30-0ubuntu0.14.04.1) ...
Installing new version of config file /etc/logrotate.d/mysql-server ...
Installing new version of config file /etc/init.d/mysql ...
Installing new version of config file /etc/init/mysql.conf ...
locale: Cannot set LC_ALL to default locale: No such file or directory
/usr/bin/locale: Cannot set LC_ALL to default locale: No such file or directory
start: Job failed to start
invoke-rc.d: initscript mysql, action "start" failed.
dpkg: error processing package mysql-server-5.6 (--configure):
subprocess installed post-installation script returned error exit status 1
E: Sub-process /usr/bin/dpkg returned an error code (1)
而且我无法登录到 phpmyadmin,所以我必须 vagrant destroy 并再次 vagrant up 并使用 5.5 ;(
知道失败的原因以及如何解决吗?
最佳答案
虽然 MySql 5.5 是 Ubuntu 14.04 的默认版本,但默认存储库中提供了 MySql 5.6。只需使用以下命令即可安装它:
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install mysql-server-5.6
如果 MySql 5.5 数据库中有现有数据,它应该会自动迁移。尽管在进行重大升级之前进行备份始终是一个好主意。
首先备份现有数据库中的数据:
mysqldump --lock-all-tables -u root -p --all-databases > dump.sql
安装新版本后,您可以根据需要通过运行进行恢复:
mysql -u root -p < dump.sql
有关迁移 MySql 数据库的更多信息,请查看:
How To Migrate a MySQL Database To A New Server On Ubuntu 14.04
关于php - 为 mysql 5.6 安装提供 shell 脚本在 Vagrant 中不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37137420/
今天有小伙伴给我留言问到,try{...}catch(){...}是什么意思?它用来干什么? 简单的说 他们是用来捕获异常的 下面我们通过一个例子来详细讲解下
我正在努力提高网站的可访问性,但我不知道如何在页脚中标记社交媒体链接列表。这些链接指向我在 facecook、twitter 等上的帐户。我不想用 role="navigation" 标记这些链接,因
说现在是 6 点,我有一个 Timer 并在 10 点安排了一个 TimerTask。之后,System DateTime 被其他服务(例如 ntp)调整为 9 点钟。我仍然希望我的 TimerTas
就目前而言,这个问题不适合我们的问答形式。我们希望答案得到事实、引用资料或专业知识的支持,但这个问题可能会引发辩论、争论、投票或扩展讨论。如果您觉得这个问题可以改进并可能重新打开,visit the
我就废话不多说了,大家还是直接看代码吧~ ? 1
Maven系列1 1.什么是Maven? Maven是一个项目管理工具,它包含了一个对象模型。一组标准集合,一个依赖管理系统。和用来运行定义在生命周期阶段中插件目标和逻辑。 核心功能 Mav
我是一名优秀的程序员,十分优秀!