1) First check if MySQL is installed in the system
Enter sudo netstat-tap inside the terminal | grep MySQL
If not reflected, the installed results are not displayed and are not installed. If shown below, you have installed
2) If it is not installed, install MySQL.
In terminal input sudo apt-get install mysql-server mysql-client
The results of the operation are as follows:
During this installation, you will be asked to enter the password for the root user (managing MySQL database user, non-linux system user), as required. As shown below:
3) test whether the installation was successful:
In terminal input sudo netstat-tap | grep MySQL
The installation succeeds if the following result is present:
4) You can also log in to MySQL test
In the terminal input Mysql-uroot-p next will prompt you to enter the password, enter the correct password, you can enter. As shown below:
5) Some simple management of MySQL:
Start MySQL service: sudo start MySQL
Stop MySQL service: sudo stop MySQL
Modify the administrator password for MySQL: sudo mysqladmin-u root password newpassword
Set up remote access (normally, the 3306 port that MySQL occupies is only listening on IP 127.0.0.1, denying access to other IPs (Netstat can see it). Cancel the local supervisor
Listen to the need to modify the My.cnf file:):
sudo vi/etc/mysql/my.cnf
Bind-address = 127.0.0.1//Find this content and comment
6) Install MySQL Workbench:
MySQL Workbench is an interface management tool: The installation method is as follows:
step1: download MySQL Workbench
: http://dev.mysql.com/downloads/tools/workbench/
Enter the Web page at the bottom of the selection of a good system version, you can download.
Step2: Installing Mysqlworkbench
To open the Terminal input command:
Sudodpkg-i Mysql-workbench-community-6.0.9-1ubu1204-i386.deb
If you are prompted to install unsuccessfully, you can enter the following command:
Apt-get-f Install
Then re-enter the command
Sudodpkg-i Mysql-workbench-community-6.0.9-1ubu1204-i386.deb
Installation Complete
7) MySQL service start, stop, restart
How to start/stop/restart MySQL
First, the starting mode
1. Start with service: Service mysqld start
2. Start with mysqld script:/etc/inint.d/mysqld start
3. Use Safe_mysqld to start:safe_mysqld&
Second, stop
1. Start with service: Service mysqld stop
2. Start with mysqld script:/etc/inint.d/mysqld stop
3, mysqladmin shutdown
Third, restart
1. Start with service: Service mysqld restart
2. Start with mysqld script:/etc/inint.d/mysqld restart
Question Editor Summary
How to start/stop/restart MySQL
First, the starting mode
1. Start with service: Service mysqld start
2. Start with mysqld script:/etc/inint.d/mysqld start
3. Use Safe_mysqld to start:safe_mysqld&
Second, stop
1. Start with service: Service mysqld stop
2. Start with mysqld script:/etc/inint.d/mysqld stop
3, mysqladmin shutdown
Third, restart
1. Start with service: Service mysqld restart
2. Start with mysqld script:/etc/inint.d/mysqld restart
When I first started to learn MySQL, I brought it with Redhat. What's the start/rc.d/init.d/start
This is very simple, but later the more learning, the system comes with MySQL, some versions are too low, some with
The low version of MySQL that you want the Web service to install
Later I learned to install MySQL in tar, my MySQL installed in the/usr/local/mysql directory
Have encountered many problems. The most common are:
ERROR 2002:can ' t connect to local MySQL server through socket
'/tmp/mysql.sock ' (111)
Workaround:
[Email protected] mysql]#/usr/local/mysql/bin/mysqladmin-u root/
>-s/var/lib/mysql/mysql.sock password ' your.passwd '
or make a connection.
Ln-s/var/lib/mysql/mysql.sock/tmp
In fact, the hint can not find/tmp/mysql.sock sometimes not the/tmp directory does not have this file, is the boot
The order is wrong, I've met
Common several start-up methods, themselves also not remember very clearly, if you are sure TMP under has mysql.sock this
Files you might want to try a few other commands.
/usr/local/mysql/bin/mysql-u root-p
/usr/local/mysql/bin/mysqld--user=mysql&
/usr/local/mysql/bin/mysqld--user=root&
/usr/local/mysql/bin/mysqld_safe--user=root&
/usr/local/mysql/bin/mysqld_safe--user=mysql&
/usr/local/mysql/bin/safe_mysqld--uer=root& (note that safe_mysqld and Mysqld_safe are different,& that MySQL runs in the background) I'll get an error.
Stopping server from PID file
/usr/local/mysql/data/localhost.localdomain.pid
060304 11:46:21 Mysqld Ended
This is a permissions issue, my MySQL directory belongs to the root user, also belongs to the root group, switch to Mysqld_safe boot is no problem,
You just have to pay attention to these few mysql,safe_mysqld,mysqld_safe,mysqld,mysqladmin. Try More
Several times
In fact, sometimes MySQL has started normally, check whether MySQL starts the command
Ps-aux | grep mysqld
You'll see something like this
MySQL 6394 0.0 1.5 10528 992 PTS/3 S 16:16 0:00
/usr/local/mysql/
MySQL 6395 0.0 1.5 10528 992 PTS/3 S 16:16 0:00
/usr/local/mysql/
MySQL 6396 0.0 1.5 10528 992 PTS/3 S 16:16 0:00
/usr/local/mysql/
Root 6422 0.0 1.1 2408 732 PTS/3 S 16:20 0:00 grep
Mysql
See if MySQL is listening on the port command
Netstat-tl | grep MySQL
You'll see something like this
TCP 0 0 *:mysql *:* LISTEN
Installation and configuration of MySQL under Linux (Ubuntu)