Install and configure mysql in linux [experience], linuxmysql
To learn MySQL in linux, the first hurdle is how to install and configure mysql in linux. We can do this once and for all with patience.
System Version: ubuntu14.04
Mysql version: mysql-server-5.5
Mysql-client-5.5
First, check whether mysql is installed. (Ctrl + Alt + T) enter the following command on the terminal:
Sudo netstat-tap | grep mysql
If no response is reported or information about successful installation is not displayed, the installation is not performed.
Next we will start the installation.
Solution:
1. Installation command:
Sudo apt-get install mysql-server mysql-client
[For new users ]:
Reading the package list... complete
Analyzing the dependency tree of the software package
Reading status information... complete
Some software packages cannot be installed. If you are using the unstable release, this may be
This is because the system cannot meet your requirements. This version may contain software you need.
Packages have not yet been created or they have been removed from the new Incoming directory.
The following information may help solve the problem:
The following software packages have dependencies that are not met:
Mysql-client: Dependency: mysql-client-5.5 but it will not be installed
Mysql-server: Dependency: mysql-server-5.5 but it will not be installed
E: the error cannot be corrected because some software packages are required to maintain the status quo, that is, they destroy the dependency between software packages.
Solution: sudo apt-get install mysql-client-core-5.5
If not, install MySQL.
Sudo apt-get install mysql-server mysql-client
During the installation process, you will be asked to enter the password of the root user (Management Mysql user, non-ubuntu user) and enter the password as required, as shown below:
2. test whether the installation is successful:
Enter sudo netstat-tap | grep mysql on the terminal
If the following result is displayed, the installation is successful:
3. You can also log on to MySQL to test
Enter mysql-uroot-p on the terminal and then prompt you to enter the correct password. As follows:
4. Some simple management of MySQL:
Start MySQL service: sudo start mysql
Stop MySQL service: sudo stop mysql
Modify the MySQL administrator password: sudo mysqladmin-u root password newpassword
Set Remote Access (normally, mysql only listens to port 3306 on IP 127.0.0.1, and denies access from other IP addresses (which can be viewed through netstat ). Cancel local monitoring
Modify the my. cnf file as follows :):
Sudo vi/etc/mysql/my. cnf
Bind-address = 127.0.0.1 // locate this content and comment
6) directory structure analysis after MySQL installation (this structure is only applicable to online installation using apt-get install ):
Database storage directory:/var/lib/mysql/
Related configuration file storage directory:/usr/share/mysql
Related command storage directory:/usr/bin (mysqladmin mysqldump and other commands)
Startup step storage directory:/etc/rc. d/init. d/