1.打开终端:
a.sudo apt-get update
b.sudo apt-get install apache2
c.sudo apt-get install php 默认安装的是7.2
d.sudo apt-get install libapache2-mod-php 安装时提示已安装
e.sudo apt-get install mysql-server-5.7
f.sudo apt-get install mysql-common 安装时提示已安装
g.sudo apt-get install mysql-admin
提示:unable to locate package mysql-admin
解决方案(未解决):https://stackoverflow.com/questions/13280931/unable-to-locate-package-mysql-admin-and-query-browser-ubuntu
h.sudo apt-get install php-mysql 默认安装的是7.2
i.sudo /etc/init.d/apache2 restart
2.配置mysql
a.登录mysql sudo mysql -u root 密码登录 sudo mysql -u root -p 输入密码
b.设置密码 GRANT ALL PRIVILEGES ON *.* TO ROOT@localhost IDENTIFIED BY “123456″;
3.LAMP附属配置
a.sudo apt-get install phpmyadmin
4.重启apache mysql服务器
a.sudo /etc/init.d/apache2 restart
b.sudo /etc/init.d/mysql restart
验证:浏览器输入:http://localhost或者http://127.0.0.1
附:设置mysql远程连接
1.mysql -u root -p;
2.GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '123456' WITH GRANT OPTION;
3.FLUSH PRIVILEGES
4.配置文件/etc/mysql/my.cnf增加两行
[mysqld]
bind-address = 0.0.0.0