Install MySql in Ubuntu

Source: Internet
Author: User
Tags php and mysql

Introduction: This is a detailed page for installing MySQL In ubuntu. It introduces the knowledge, skills, and experience related to installing MySql in PHP, MySQL, PHP, Apache, and ubuntu, and some PHP source code.

Class = 'pingjiaf' frameborder = '0' src = 'HTTP: // biancheng.dnbc?info/pingjia.php? Id = 360995 'rolling = 'no'>
Installing MySql in Ubuntu saves a lot of trouble.

Basically, I sorted out the online materials.

1. Install MySQL

 
Sudo apt-Get install mysql-server mysql-Client # You will be asked to enter the root user password once in the middle

 
Sudo apt-Get install php5-mysql # installation php5-mysql is to connect PHP and MySQL

After the installation is complete, the MySQL server should have started up. Manual start method:

 
Sudo start MySQL # Start it manually

 
Sudo stop MySQL # manually stop

After you modify the configuration file, you need to restart mysqld to make these changes take effect.

To check whether the mysqld process is enabled, run the following command:

 
Pgrep mysqld

If the process is enabled, the command returns the ID of the process.

Go to MySQL

 
Mysql-uroot-P

After entering the MySQL Root Password, you can see the following results:

 
Hadoop @ Ubuntu :~ $ Mysql-uroot-penter password: Welcome to the MySQL monitor. commands end with; or \ G. your MySQL connection ID is 62 server version: 5.1.41-3ubuntu12. 10 (UBUNTU) type 'help; 'or' \ H' for help. type '\ C' to clear the current input statement. mysql>

2. Install phpMyAdmin

Install Apache, a web server that supports PHP, and download and install phpMyAdmin to manage the MySQL database on the web end.

1) install apache2

 
Sudo apt-Get install apache2

2) install PhP5 and Apache PhP5 modules

 
Sudo apt-Get install PhP5 libapache2-mod-php5

Restart Apache

 
Sudo/etc/init. d/apache2 restart

3) install phpMyAdmin

 
Sudo apt-Get install phpMyAdmin

3. Configuration File

1) edit the PHP configuration file and run it on the terminal.

 
Sudo gedit/etc/PhP5/apache2/PHP. ini

In the pop-up interface, find the extension help document and syntax, and add:

 
Extension = php5-mcrypt.so

Find

 
; Date. timezone =

Replace:

 
Date. timezone = PRC

Indicates the People's Republic of China (GMT + 8 time zone)

Save and close this document, restart Apache, and run:

 
Sudo/etc/init. d/apache2 restart

2) Configure Apache

 
Sudo gedit/etc/apache2/apache2.conf

Add the following lines at the end of the configuration file to support the file type:

 
Addtype application/X-httpd-PHP. php. htm. html

Default Character Set Based on your needs

 
Adddefacharcharset UTF-8

The order of adding the three homepage files can be changed to the previous access priority (of course, you can also add other settings such as default. php)

<Ifmodule dir_module> directoryindex index.htm index.html index. php </ifmodule>

3) Configure phpMyAdmin

PhpMyAdmin is not installed under/var/WWW by default, but in/usr/share/phpMyAdmin

Right-click the folder, create a link, copy the link, and change the file name of The Link folder to phpMyAdmin.

After the installation is complete, the 404 error occurs when you access http: // localhost/phpMyAdmin. This is because the phpMyAdmin directory is not mapped to the Apache directory. Run the following command:

 
Sudo ln-S/usr/share/PHPmyAdmin/var/WWW

Then run the command in the terminal

 
Sudo gedit/etc/PHPmyAdmin/Apache. conf
 
Alias/PHPmyAdmin/usr/share/phpMyAdmin <directory/usr/share/phpMyAdmin>

Changed:

 
Alias/PHPmyAdmin/var/www/phpMyAdmin <directory/var/www/phpMyAdmin>

After completing this step, restart Apache:

 
Sudo/etc/init. d/apache2 restart

4) Open the browser and enter http: // localhost/. If the following text is displayed, it indicates that Apache has been configured.
Reference it works!

This is the default web page for this server.

The web server software is running but no content has been added, yet.

Enter http: // localhost/phpMyAdmin in the browser.

Problems:

I deleted both the MySQL user group and the MySQL user. As a result, when I started Ubuntu again, I couldn't start the MySQL service, and there was always a failure to start. After checking the information on the Internet for half a day, the problem was not solved. Finally, the MySQL user group and MySQL user were re-established.

If you enable http: // localhost/phpMyAdmin, the following error occurs:
An error occurred while referencing the user control defined in the configuration file.

Open the/etc/PHPmyAdmin/config. Inc. php file,

 
Sudo gedit/etc/PHPmyAdmin/config. Inc. php

Delete # In Front Of The following text,
Reference
$ Cfg ['servers'] [$ I] ['pmadb'] = 'phpmyadmin ';

$ Cfg ['servers'] [$ I] ['bookmarktable'] = 'pma _ bookmark ';

$ Cfg ['servers'] [$ I] ['relation'] = 'pma _ relation ';

$ Cfg ['servers'] [$ I] ['table _ info'] = 'pma _ table_info ';

$ Cfg ['servers'] [$ I] ['table _ coords '] = 'pma _ table_coords ';

$ Cfg ['servers'] [$ I] ['pdf _ page'] = 'pma _ pdf_pages ';

$ Cfg ['servers'] [$ I] ['column _ info'] = 'pma _ column_info ';

$ Cfg ['servers'] [$ I] ['History '] = 'pma _ history ';

$ Cfg ['servers'] [$ I] ['designer _ coords '] = 'pma _ designer_coords ';

In addition, perform the following settings.
Reference
$ Cfg ['servers'] [$ I] ['controluser'] = 'root ';

$ Cfg ['servers'] [$ I] ['controlpass'] = 'root123 ';

$ Cfg ['servers'] [$ I] ['host'] = '2017. 0.0.1 ';

Log on to the phpMyAdmin web page again.

Reference webpage:

1. http://wiki.ubuntu.org.cn/MySQL

2. http://www.pkphp.com/2008/08/11/ubuntu%E4%B8%8B%E5% AE %89%E8%A3%85-apachephpmysql%E6%96%87%E6%9C%AC%E6%9C%8D%E5%8A%A1%E5%99%A8%EF%BC%81/

3. http://forum.ubuntu.org.cn/viewtopic.php? T = 251355

Love J2EE follow Java Michael Jackson video station JSON online tools

Http://biancheng.dnbcw.info/php/360995.html pageno: 1.

Related Article

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.