MySql Ubuntu下安装和配置:
1 安装在联网环境下
sudo apt-get install mysql-server
命令执行需要root的密码输入;若mysql安装完成,mysql服务器会自动启动,运行以下命令查看确认mysql服务器是否运行;
sudo netstat -tap | grep mysql
若正常运行会有如下的类似信息;
tcp 0 0 localhost:mysql *:* LISTEN 2556/mysqld
dalek@ubuntu:~/work/epoll$ sudo netstat -tap | grep mysql
[sudo] password for dalek:
tcp 0 0 localhost:mysql *:* LISTEN 6959/mysqld
sudo /etc/init.d/mysql restart
2 配置信息
你可以编辑 /etc/mysql/my.cnf文件对mysql做基本的配置设置,如日志文件,端口号等等,
配置完毕后需要关闭mysql,重新启动mysql;
sudo /etc/init.d/mysql restart
3 删除mysql
sudo apt-get remove mysql-server
sudo apt-get remove common
安装过程如下:
dalek@ubuntu:~/work/epoll$ sudo apt-get install mysql-server
Reading package lists... DoneBuilding dependency tree
Reading state information... Done
The following extra packages will be installed:
libdbd-mysql-perl libdbi-perl libhtml-template-perl libmysqlclient18 libnet-daemon-perl libplrpc-perl mysql-client-5.5
mysql-client-core-5.5 mysql-common mysql-server-5.5 mysql-server-core-5.5
Suggested packages:
libipc-sharedcache-perl libterm-readkey-perl tinyca mailx
The following NEW packages will be installed:
libdbd-mysql-perl libdbi-perl libhtml-template-perl libmysqlclient18 libnet-daemon-perl libplrpc-perl mysql-client-5.5
mysql-client-core-5.5 mysql-common mysql-server mysql-server-5.5 mysql-server-core-5.5
0 upgraded, 12 newly installed, 0 to remove and 280 not upgraded.
Need to get 26.5 MB of archives.
After this operation, 91.9 MB of additional disk space will be used.
Do you want to continue [Y/n]? y
Get:1 http://us.archive.ubuntu.com/ubuntu/ precise-updates/main mysql-common all 5.5.24-0ubuntu0.12.04.1 [13.5 kB]
Get:2 http://us.archive.ubuntu.com/ubuntu/ precise-updates/main libmysqlclient18 i386 5.5.24-0ubuntu0.12.04.1 [921 kB]
Get:3 http://us.archive.ubuntu.com/ubuntu/ precise/main libnet-daemon-perl all 0.48-1 [43.1 kB]
Get:4 http://us.archive.ubuntu.com/ubuntu/ precise/main libplrpc-perl all 0.2020-2 [36.0 kB]
Get:5 http://us.archive.ubuntu.com/ubuntu/ precise/main libdbi-perl i386 1.616-1build2 [849 kB]
Get:6 http://us.archive.ubuntu.com/ubuntu/ precise/main libdbd-mysql-perl i386 4.020-1build2 [104 kB]
Get:7 http://us.archive.ubuntu.com/ubuntu/ precise-updates/main mysql-client-core-5.5 i386 5.5.24-0ubuntu0.12.04.1 [1,859 kB]
Get:8 http://us.archive.ubuntu.com/ubuntu/ precise-updates/main mysql-client-5.5 i386 5.5.24-0ubuntu0.12.04.1 [8,067 kB]
Get:9 http://us.archive.ubuntu.com/ubuntu/ precise-updates/main mysql-server-core-5.5 i386 5.5.24-0ubuntu0.12.04.1 [5,799 kB]
Get:10 http://us.archive.ubuntu.com/ubuntu/ precise-updates/main mysql-server-5.5 i386 5.5.24-0ubuntu0.12.04.1 [8,714 kB]
Get:11 http://us.archive.ubuntu.com/ubuntu/ precise/main libhtml-template-perl all 2.10-1 [65.0 kB]
Get:12 http://us.archive.ubuntu.com/ubuntu/ precise-updates/main mysql-server all 5.5.24-0ubuntu0.12.04.1 [11.7 kB]
Fetched 26.5 MB in 7min 1s (62.8 kB/s)
Preconfiguring packages ...
鈹屸攢鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹Configuring mysql-server-5.5 鈹溾攢鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹[17;4H鈹While not mandatory, it is highly recommended that you set a password for the MySQL administrative "root" user. 鈹[18;4H鈹[114C鈹[19;4H鈹If this field is left blank, the password will not be changed. 鈹[20;4H鈹[114C鈹[21;4H鈹New password for the MySQL "root" user:鈹[22;4H鈹[114C鈹[23;4H鈹________________________________________________________________________________________________________________ 鈹[24;4H鈹[114C鈹[25;4H鈹[54C<Ok> 鈹[26;4H鈹[114C鈹[27;4H鈹斺攢鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹Selecting previously unselected package mysql-common.
(Reading database ... 144880 files and directories currently installed.)
Unpacking mysql-common (from .../mysql-common_5.5.24-0ubuntu0.12.04.1_all.deb) ...
Selecting previously unselected package libmysqlclient18.
Unpacking libmysqlclient18 (from .../libmysqlclient18_5.5.24-0ubuntu0.12.04.1_i386.deb) ...
Selecting previously unselected package libnet-daemon-perl.
Unpacking libnet-daemon-perl (from .../libnet-daemon-perl_0.48-1_all.deb) ...
Selecting previously unselected package libplrpc-perl.
Unpacking libplrpc-perl (from .../libplrpc-perl_0.2020-2_all.deb) ...
Selecting previously unselected package libdbi-perl.
Unpacking libdbi-perl (from .../libdbi-perl_1.616-1build2_i386.deb) ...
Selecting previously unselected package libdbd-mysql-perl.
Unpacking libdbd-mysql-perl (from .../libdbd-mysql-perl_4.020-1build2_i386.deb) ...
Selecting previously unselected package mysql-client-core-5.5.
Unpacking mysql-client-core-5.5 (from .../mysql-client-core-5.5_5.5.24-0ubuntu0.12.04.1_i386.deb) ...
Selecting previously unselected package mysql-client-5.5.
Unpacking mysql-client-5.5 (from .../mysql-client-5.5_5.5.24-0ubuntu0.12.04.1_i386.deb) ...
Selecting previously unselected package mysql-server-core-5.5.
Unpacking mysql-server-core-5.5 (from .../mysql-server-core-5.5_5.5.24-0ubuntu0.12.04.1_i386.deb) ...
Processing triggers for man-db ...
Setting up mysql-common (5.5.24-0ubuntu0.12.04.1) ...
Selecting previously unselected package mysql-server-5.5.
(Reading database ... 145246 files and directories currently installed.)
Unpacking mysql-server-5.5 (from .../mysql-server-5.5_5.5.24-0ubuntu0.12.04.1_i386.deb) ...
鈹屸攢鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹Configuring mysql-server-5.5 鈹溾攢鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹[17;4H鈹While not mandatory, it is highly recommended that you set a password for the MySQL administrative "root" user. 鈹[18;4H鈹[114C鈹[19;4H鈹If this field is left blank, the password will not be changed. 鈹[20;4H鈹[114C鈹[21;4H鈹New password for the MySQL "root" user:鈹[22;4H鈹[114C鈹[23;4H鈹________________________________________________________________________________________________________________ 鈹[24;4H鈹[114C鈹[25;4H鈹[54C<Ok> 鈹[26;4H鈹[114C鈹[27;4H鈹斺攢鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹 鈹________________ 鈹斺攢鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹 鈹屸攢鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹Configuring mysql-server-5.5 鈹溾攢鈹€ 鈹Password input error 鈹斺攢鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹 鈹屸攢鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹Configuring mysql-server-5.5 鈹溾攢鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹[17;4H鈹While not mandatory, it is highly recommended that you set a password for the MySQL administrative "root" user. 鈹[18;4H鈹[114C鈹[19;4H鈹If this field is left blank, the password will not be changed. 鈹[20;4H鈹[114C鈹[21;4H鈹New password for the MySQL "root" user:鈹[22;4H鈹[114C鈹[23;4H鈹________________________________________________________________________________________________________________ 鈹[24;4H鈹[114C鈹[25;4H鈹[54C<Ok> 鈹[26;4H鈹[114C鈹[27;4H鈹斺攢鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹
Selecting previously unselected package libhtml-template-perl.
Unpacking libhtml-template-perl (from .../libhtml-template-perl_2.10-1_all.deb) ...
Selecting previously unselected package mysql-server.
Unpacking mysql-server (from .../mysql-server_5.5.24-0ubuntu0.12.04.1_all.deb) ...
Processing triggers for man-db ...
Processing triggers for ureadahead ...
ureadahead will be reprofiled on next reboot
Setting up libmysqlclient18 (5.5.24-0ubuntu0.12.04.1) ...
Setting up libnet-daemon-perl (0.48-1) ...
Setting up libplrpc-perl (0.2020-2) ...
Setting up libdbi-perl (1.616-1build2) ...
Setting up libdbd-mysql-perl (4.020-1build2) ...
Setting up mysql-client-core-5.5 (5.5.24-0ubuntu0.12.04.1) ...
Setting up mysql-client-5.5 (5.5.24-0ubuntu0.12.04.1) ...
Setting up mysql-server-core-5.5 (5.5.24-0ubuntu0.12.04.1) ...
Setting up mysql-server-5.5 (5.5.24-0ubuntu0.12.04.1) ...
鈹屸攢鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹Configuring mysql-server-5.5 鈹溾攢鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹[17;4H鈹While not mandatory, it is highly recommended that you set a password for the MySQL administrative "root" user. 鈹[18;4H鈹[114C鈹[19;4H鈹If this field is left blank, the password will not be changed. 鈹[20;4H鈹[114C鈹[21;4H鈹New password for the MySQL "root" user:鈹[22;4H鈹[114C鈹[23;4H鈹________________________________________________________________________________________________________________ 鈹[24;4H鈹[114C鈹[25;4H鈹[54C<Ok> 鈹[26;4H鈹[114C鈹[27;4H鈹斺攢鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹
mysql start/running, process 6959
Setting up libhtml-template-perl (2.10-1) ...
Setting up mysql-server (5.5.24-0ubuntu0.12.04.1) ...
Processing triggers for libc-bin ...
ldconfig deferred processing now taking place