以下是在Linux系統上安裝MySQL虛擬主機的方法:
sudo apt-get install mysql-server
sudo apt-get install apache2
sudo apt-get install php libapache2-mod-php php-mysql
mysql -u root -p
CREATE USER ‘username’@‘localhost’ IDENTIFIED BY ‘password’;
CREATE DATABASE database_name
;
GRANT ALL PRIVILEGES ON database_name
.* TO ‘username’@‘localhost’;
FLUSH PRIVILEGES;
exit
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html/domain_name
ServerName domain_name.com
ServerAlias www.domain_name.com
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
sudo service apache2 restart
以上是在Linux系統上安裝MySQL虛擬主機的方法。