Install Mysql in Ubuntu

  1. sudo apt-get install mysql-server

  2. sudo apt-get isntall mysql-client

  3. sudo apt-get install libmysqlclient-dev

During the installation, you will be prompted to set the user name and password of the root account. To check whether mysql is installed successfully, run the following command to view the mysql listening port: sudo netstat -tap | grep mysql

yang@yang-K45VD:~$ sudo netstat -tap | grep mysql
tcp        0      0 localhost:mysql         *:*                     LISTEN      6688/mysqld     
yang@yang-K45VD:~$ 

Copy the code

-u root -p enter password for mysqlmysql

yang@yang-K45VD:~$ mysql -u root -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 13 Server version: Ubuntu Copyright (C) 2000, 2017, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type'help; ' or '\h' for help. Type '\c' to clear the current input statement.

mysql> 

Copy the code

You can now see that the installation and login were successful.

Visual mysql client in Linux I choose phpMyadmin below to introduce phpMyadmin installation and configuration

Install phpmyadmin

sudo apt-get install phpmyadmin

Note that since we have installed and configured MySQL, during the installation process when phpMyAdmin asks us if we want to automatically generate MySQL configuration, we usually choose no. /usr/share/phpmyadmin/ sudo cp -rf /usr/share/phpmyadmin/ sudo cp -rf /usr/share/phpmyadmin/ sudo cp -rf /usr/share/phpmyadmin/ The root directory of your Apache server here also need to pay attention to, the direct access to the http://localhost/phpmyadmin/ complains as follows

The mbstring extension is missing.
Copy the code

Lacking PHP’s MBString extension, I found a solution here that worked in my tests. Here is: The location of the configuration file in your solution may vary depending on your version of PHP, /etc/ PHP /7.0/mods-available cancel the comment in front of json.ini file priority=20. Restart the Apache and then visit http://localhost/phpmyadmin/ in the browser.