在DEBIAN 9 或 UBUNTU 16.10 系统中配置LAMP环境

前面我们的大部分都是基于宝塔BT PANEL面板适配安装的WEB环境。下面我们记录一下Debian9、Ubuntu16.10下的LAMP的安装方法。

Installation安装步骤

Install Apache, MariaDB, PHP

在root环境中运行如下命令Run the following command with sudo or as root:

apt-get install apache2 mariadb-server php-mysql

为MariaDB下的root用户设置密码Add a password to the user ROOT of MariaDB

跟mysql安装不同,在设置导向时可以设置root密码。这里需要手动运行代如下代码。It seems, unlike mysql, MariaDB is not asking to setup a root password when you install it. This means it is a step faster to run development apps, but you will need to set it up manually. Simply run:

mysqladmin -u root password 'enter password here'

and restart the service然后重启服务

service mysql restart

Install 安装 PHPMyAdmin

You probably wants to install PHPMyAdmin to simplify the management of your databases (Can be easily done with the web interface). The installation is simple, still in root or with sudo run:下面我们使用apt来安装一下phpmyadmin,在终端中运行如下命令

apt-get install phpmyadmin

however, MySQL 5.7 (and thus MariaDB) changed their model for security. Now to connect to MySQL root, you will need sudo or to be logged in as root on your machine. This also means that phpMyAdmin will not be able to use root as a user.

You will need to create a dedicated user to do so. Here is how:下面手动创建一个用户并且给数据库授权

mysql -u root
CREATE USER 'newuser'@'localhost' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON *.* TO 'newuser'@'localhost' WITH GRANT OPTION;
FLUSH PRIVILEGES;
exit

Replace newuser with the user you want and password with the password you want.

The restart the service.重启服务

service mysql restart

Now you should have access to Phpmyadmin at and use the newly created user/password combo to use PhpMyAdmin.下面可以在浏览器中输入如下地址运行phpmyadmin

http://yourserver/phpmyadmin

链接到文章: https://ixvps.com/45109.html

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注