Install Mysql in Linux
1. Preparations
2. dependencies required for Mysql Installation
2.1 install Mysql
3 Common commands
3.1 verify that the original host is installed
3.2 start
3.3 Login
3.4 Remote Login
3.5 restart the service
3.6 Stop Service
3.7 view service status
4. Error Solution
1. Preparations
This document describes how to install mysql 5.6 in ubuntu14.04.
1. software used: Ubuntu14.04
2. We recommend that you use the root user.
3. Use the server address 192.168.1.236
4. Install mysql5.6.19
2. dependencies required for Mysql Installation
Mysql installation depends on, or startup fails.
apt-get install mysql-client-core-5.6apt-get install mysql-client-5.6
2.1 install Mysql
If the command line information is similar
apt-get install mysql-server-5.6
Enter the root password during installation;
3 Common commands
3.1 verify that the original host is installed
Run the sudo netstat-tap | grep mysql command to check whether the MySQL port exists. If sudo is not added, the execution fails because of the permission:
netstat -tap | grep mysql
3.2 start
# Start MySQL $ sudo service mysql start # Close MySQL $ sudo service mysql stop # restart MySQL $ sudo service mysql restart # other commands: $ sudo/etc/init. d/mysql start $ sudo/etc/init. d/mysql stop $ sudo/etc/init. d/mysql restart
Then, run the following command again to check whether MySQL has been started:
$ netstat -tap | grep mysql
MySQL listening on localhost indicates that MySQL has been started.
3.3 Login
Use the command line mysql-u root-p to log on to MySQL:
$ mysql -u root -p
3.4 Remote Login
$ mysql -h192.168.1.160 -u root -p
3.5 restart the service
sudo service mysql restart
3.6 Stop Service
sudo service mysql stop
3.7 view service status
sudo service mysql status
4. Error Solution
========================================================== ========================================================== ====
Error: [this error is usually reported when mysql is installed]
E: Sub-process/usr/bin/dpkg returned an error code (1)
The following error occurs after the root password is set twice:
After this operation, 0 B of additional disk space will be used.Setting up mysql-server-5.5 (5.5.28-0ubuntu0.12.04.2) ...121209 0:30:00 [Note] Plugin 'FEDERATED' is disabled.121209 0:30:00 InnoDB: The InnoDB memory heap is disabled121209 0:30:00 InnoDB: Mutexes and rw_locks use GCC atomic builtins121209 0:30:00 InnoDB: Compressed tables use zlib 1.2.3.4121209 0:30:00 InnoDB: Initializing buffer pool, size = 128.0M121209 0:30:00 InnoDB: Completed initialization of buffer pool121209 0:30:00 InnoDB: highest supported file format is Barracuda.121209 0:30:00 InnoDB: Waiting for the background threads to start121209 0:30:01 InnoDB: 1.1.8 started; log sequence number 1595675121209 0:30:01 InnoDB: Starting shutdown...121209 0:30:01 InnoDB: Shutdown completed; log sequence number 1595675AppArmor parser error for /etc/apparmor.d/usr.sbin.mysqld in /etc/apparmor.d/usr.sbin.mysqld at line 9: Could not open 'abstractions/mysql'start: Job failed to startinvoke-rc.d: initscript mysql, action "start" failed.dpkg: error processing mysql-server-5.5 (--configure):subprocess installed post-installation script returned error exit status 1dpkg: dependency problems prevent configuration of mysql-server:mysql-server depends on mysql-server-5.5; however:Package mysql-server-5.5 is not configured yet.dpkg: error processing mysql-server (--configure):dependency problems - leaving unconfiguredNo apport report written because the error message indicates its a followup error from a previous failure.Errors were encountered while processing:mysql-server-5.5mysql-serverE: Sub-process /usr/bin/dpkg returned an error code (1)
Solution:
Run sudo apt-get install mysql-server
Uninstall Mysql:
sudo apt-get autoremove mysql* --purgesudo apt-get remove apparmorsudo apt-get install mysql-server mysql-common
Before deleting mysql, 'Remember to delete/var/lib/mysql and/etc/mysql. [In a word, check the mysql path and delete all the files with mysql. The purpose is to uninstall them completely]