Install PHP MySql in Ubuntu

Source: Internet
Author: User
Tags php and mysql php mysql

Considering the painful experience of testing the WordPress topic here, I decided to build a web platform to test it on the local machine first.

I wanted to install it in opensuse, but think about the apt-Get keys and press them a lot, so I will first remove them in Ubuntu.
Follow the unofficial Ubuntu 6.06 (dapper Drake) Linux Starter Guide steps

1. Install apache2
Sudo apt-Get install apache2
Then open it in Firefox:
Http: // localhost/
Prompt successful

Ii. Install PhP5
Sudo apt-Get install PhP5
Sudo apt-Get install libapache2-mod-php5 (according to my actual test, this step does not seem to have to be done, has been installed in the previous step, but it is recommended that you copy/paste this command)
Sudo/etc/init. d/apache2 restart

Test whether PhP5 is successfully installed.
Sudo gedit/var/www/testphp. php
Write in
Then open it in Firefox:
Http: // localhost/testphp. php
We should be able to see the following picture. It's very long.
Php5.png
Deleting testphp. php after reading it may cause security risks.

Iii. Install MySQL
Sudo apt-Get install mysql-Server

MySQL only allows connections from the Local Machine (127.0.0.1). If you want to use multiple hosts or open them to the Internet, edit/etc/MySQL/My. CNF
Sudo gedit/etc/MySQL/My. CNF
Find
Bind-address = 127.0.0.1
Comment out with #, as shown in the following figure:
# Bind-address = 127.0.0.1

MySQL does not set the root password by default, and the root user of the local machine does not have the password. Is it risky?
Mysqladmin-u root password your-New-Password
Mysqladmin-h root @ local-machine-name-u root-P password your-New-Password (here I cannot connect to the MySQL server, and I changed it in MySQL-Admin)
Sudo/etc/init. d/MySQL restart

Install MySQL Administrator
Sudo apt-Get install mysql-Admin
After installation, go to gnome-Application-System Tools-mysql Administrator

Here I encountered a problem, that is, after running MySQL administrator, click User administrator, the entire MySQL administrator crashes, and finally solved the problem. The solution is described later.

Install MySQL for Apache HTTP Server
Sudo apt-Get install libapache2-mod-auth-mysql
Sudo apt-Get install php5-mysql
Sudo apt-Get install phpMyAdmin

To make PHP and MySQL work together, Edit
Sudo gedit/etc/PhP5/apache2/PHP. ini
Uncomment; Extension = mysql. So, as shown in the following figure:
...
Extension = mysql. So
...

Save the file, and then
Sudo/etc/init. d/apache2 restart

Test:
Http: // localhost/phpMyAdmin

Here, I can modify users and add new users. I will go back and solve the problem that the MySQL administrator crashes after clicking user administrator. See the following URL:
MySQL administrator hangs after pressing user administration icon
Experts have different solutions:
In the terminal:
Export debug_dont_spawn_fetches = 1
Mysql-Admin

In this way, the user can be modified smoothly.


From: http://hi.baidu.com/zznoip/blog/item/e70b0c0b643f8c296b60fbe4.html

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.