Ubuntu 16.04 Build Lamp Server environment process

Source: Internet
Author: User

Use the following command to install MySQL:

sudo apt-get install mysql-server

The above command installs the following packages:
AppArmor
mysql-client-5.7
Mysql-common
Mysql-server
mysql-server-5.7
mysql-server-core-5.7
So there is no need to install mysql-client and so on. The installation process will prompt you to set the password for the MySQL root user and wait for the installation to be installed after Setup is complete. MySQL is started when the default installation is complete.

    • To start and shut down the MySQL server:
startservice mysql stop

    • Confirm that the start is successful:
sudo netstat -tap | grep mysql

    • Enter the MySQL Shell interface:
-u root -p

    • Solve the problem of using Sqoop to import MySQL Chinese garbled characters
      The reason why the Chinese characters are garbled when importing is that the Character_set_server default setting is Latin1, such as.

      You can modify the encoding in a single setting set character_set_server=utf8; but the restart will fail, and we recommend that you modify the encoding as follows.
      (1) Edit the configuration file. sudo vi /etc/mysql/mysql.conf.d/mysqld.cnf
      (2) Add a line under [Mysqld] character_set_server=utf8 . Such as

      (3) Restart the MySQL service. service mysql restart
      (4) Log in to MySQL and view the current encoding show variables like "char%"; of MySQL settings

      In this way, you can happily import Chinese!

Let 's review the problems I encountered during the installation process:
1, the installation Renaming removed key_buffer and myisam-recover options (if present) is stuck, and CTRL + C can not quit, and finally I closed the terminal forced to quit, but I found that the use sudo netstat -tap | grep mysql of incredibly display is the start of success, but into the shell interface will appear problems, prompted ERROR 1045 (28000): Access denied for user ‘root‘@‘localhost‘ (using password:YES) the internet to find a bunch of methods, Can not be solved.
Reluctantly consider unloading load:

sudo apt-get autoremove mysql* --purgesudo apt-get remove apparmor   //这个apparmor是在装mysql-server时装上的,和安全有关

2, Restart the computer (many times restart is a magic weapon), again using the command apt-get installation Mysql-server, run to Renaming removed key_buffer and myisam-recover options (if present) still stuck, I stopped the terminal again, found that the boot is also successful, try to enter the shell interface, There is another new error: ERROR 2002 (HY000): Can‘t connect to local MySQL server through socket ‘/var/run/mysqld/mysqld.sock‘ (2) , and then find a lot of domestic and foreign materials, Baidu can not search out and this error is completely related, or honest FQ on Google, the proposed program is to delete some duplicate configuration files, but I /var/run/mysqld/mysqld.sock do not have this, so still cannot solve.
Uninstall again. Consider being sure to uninstall very thoroughly.

sudo apt-get autoremove mysql* --purgesudo apt-get remove apparmor  sudo rm /var/lib/mysql/ -R //非常重要sudo rm /etc/mysql/ -R //非常重要

3 . Restart the computer and successfully install the command again sudo apt-get install mysql-server !

Summary: Be sure to uninstall very clean!

Ubuntu 16.04 Build Lamp Server environment process

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.