Ubuntu 11.04 通过 apt 安装 MySQL 5.1 的全过程记录


Ubuntu 11.04 通过 apt 安装 MySQL 5.1 的全过程记录: 相关阅读: Linux下MySQL 5.5.11编译安装笔记(完整安装教程) Ubuntu下编译安装MySQL双实例并配置主从复制 Ubuntu 11.04 (32-bit)环境编译安装MySQL 5.5 1) $ sudo apt-get install mysql-server
 Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
libdbd-mysql-perl libdbi-perl libhtml-template-perl libmysqlclient16 libnet-daemon-perl
libplrpc-perl mysql-client-5.1 mysql-client-core-5.1 mysql-common mysql-server-5.1
mysql-server-core-5.1
Suggested packages:
libipc-sharedcache-perl tinyca mailx
The following NEW packages will be installed:
libdbd-mysql-perl libdbi-perl libhtml-template-perl libmysqlclient16 libnet-daemon-perl
libplrpc-perl mysql-client-5.1 mysql-client-core-5.1 mysql-common mysql-server
mysql-server-5.1 mysql-server-core-5.1
0 upgraded, 12 newly installed, 0 to remove and 28 not upgraded.
Need to get 23.9 MB of archives.
After this operation, 61.1 MB of additional disk space will be used.
Do you want to continue [Y/n]? y
Get:1 http://cn.archive.ubuntu.com/ubuntu/ natty/main mysql-common all 5.1.54-1ubuntu4 [12.2 kB]
Get:2 http://cn.archive.ubuntu.com/ubuntu/ natty/main mysql-common all 5.1.54-1ubuntu4 [12.2 kB]
Get:3 http://cn.archive.ubuntu.com/ubuntu/ natty/main libnet-daemon-perl all 0.43-1 [46.9 kB]
Get:4 http://cn.archive.ubuntu.com/ubuntu/ natty/main libplrpc-perl all 0.2020-2 [36.0 kB]
Get:5 http://cn.archive.ubuntu.com/ubuntu/ natty/main libdbi-perl amd64 1.612-1 [846 kB]
Get:6 http://cn.archive.ubuntu.com/ubuntu/ natty/main libmysqlclient16 amd64 5.1.54-1ubuntu4 [1869 kB]
Get:7 http://cn.archive.ubuntu.com/ubuntu/ natty/main libmysqlclient16 amd64 5.1.54-1ubuntu4 [1869 kB]
Get:8 http://cn.archive.ubuntu.com/ubuntu/ natty/main libdbd-mysql-perl amd64 4.016-1 [140 kB]
Get:9 http://cn.archive.ubuntu.com/ubuntu/ natty/main mysql-client-core-5.1 amd64 5.1.54-1ubuntu4 [102 kB]
Get:10 http://cn.archive.ubuntu.com/ubuntu/ natty/main mysql-client-5.1 amd64 5.1.54-1ubuntu4 [9370 kB]
Get:11 http://cn.archive.ubuntu.com/ubuntu/ natty/main mysql-client-5.1 amd64 5.1.54-1ubuntu4 [9370 kB]
Get:12 http://cn.archive.ubuntu.com/ubuntu/ natty/main mysql-server-core-5.1 amd64 5.1.54-1ubuntu4 [4976 kB]
Get:13 http://cn.archive.ubuntu.com/ubuntu/ natty/main mysql-server-5.1 amd64 5.1.54-1ubuntu4 [6386 kB]
Get:14 http://cn.archive.ubuntu.com/ubuntu/ natty/main mysql-server-5.1 amd64 5.1.54-1ubuntu4 [6386 kB]
Get:15 http://cn.archive.ubuntu.com/ubuntu/ natty/main mysql-server-5.1 amd64 5.1.54-1ubuntu4 [6386 kB]
Get:16 http://cn.archive.ubuntu.com/ubuntu/ natty/main libhtml-template-perl all 2.9-2 [67.1 kB]
Get:17 http://cn.archive.ubuntu.com/ubuntu/ natty/main mysql-server all 5.1.54-1ubuntu4 [6828 B]
...

2) 设置root帐号的密码 Ubuntu 11.04 通过 apt 安装 Mysql 5.1 的全过程记录 - rongjih - 拥有自己的梦想,跟随心的召唤  Ubuntu 11.04 通过 apt 安装 Mysql 5.1 的全过程记录 - rongjih - 拥有自己的梦想,跟随心的召唤  3) 安装过程的细节
 Selecting previously deselected package mysql-common.
(Reading database ... 50200 files and directories currently installed.)
Unpacking mysql-common (from .../mysql-common_5.1.54-1ubuntu4_all.deb) ...
Selecting previously deselected package libnet-daemon-perl.
Unpacking libnet-daemon-perl (from .../libnet-daemon-perl_0.43-1_all.deb) ...
Selecting previously deselected package libplrpc-perl.
Unpacking libplrpc-perl (from .../libplrpc-perl_0.2020-2_all.deb) ...
Selecting previously deselected package libdbi-perl.
Unpacking libdbi-perl (from .../libdbi-perl_1.612-1_amd64.deb) ...
Selecting previously deselected package libmysqlclient16.
Unpacking libmysqlclient16 (from .../libmysqlclient16_5.1.54-1ubuntu4_amd64.deb) ...
Selecting previously deselected package libdbd-mysql-perl.
Unpacking libdbd-mysql-perl (from .../libdbd-mysql-perl_4.016-1_amd64.deb) ...
Selecting previously deselected package mysql-client-core-5.1.
Unpacking mysql-client-core-5.1 (from .../mysql-client-core-5.1_5.1.54-1ubuntu4_amd64.deb) ...
Selecting previously deselected package mysql-client-5.1.
Unpacking mysql-client-5.1 (from .../mysql-client-5.1_5.1.54-1ubuntu4_amd64.deb) ...
Selecting previously deselected package mysql-server-core-5.1.
Unpacking mysql-server-core-5.1 (from .../mysql-server-core-5.1_5.1.54-1ubuntu4_amd64.deb) ...
Processing triggers for man-db ...
locale: Cannot set LC_CTYPE to default locale: No such file or directory
locale: Cannot set LC_MESSAGES to default locale: No such file or directory
locale: Cannot set LC_ALL to default locale: No such file or directory
Setting up mysql-common (5.1.54-1ubuntu4) ...
Selecting previously deselected package mysql-server-5.1.
(Reading database ... 50575 files and directories currently installed.)
Unpacking mysql-server-5.1 (from .../mysql-server-5.1_5.1.54-1ubuntu4_amd64.deb) ...
locale: Cannot set LC_CTYPE to default locale: No such file or directory
locale: Cannot set LC_MESSAGES to default locale: No such file or directory
locale: Cannot set LC_ALL to default locale: No such file or directory
Selecting previously deselected package libhtml-template-perl.
Unpacking libhtml-template-perl (from .../libhtml-template-perl_2.9-2_all.deb) ...
Selecting previously deselected package mysql-server.
Unpacking mysql-server (from .../mysql-server_5.1.54-1ubuntu4_all.deb) ...
Processing triggers for ureadahead ...
ureadahead will be reprofiled on next reboot
Processing triggers for man-db ...
locale: Cannot set LC_CTYPE to default locale: No such file or directory
locale: Cannot set LC_MESSAGES to default locale: No such file or directory
locale: Cannot set LC_ALL to default locale: No such file or directory
Setting up libnet-daemon-perl (0.43-1) ...
Setting up libplrpc-perl (0.2020-2) ...
Setting up libdbi-perl (1.612-1) ...
Setting up libmysqlclient16 (5.1.54-1ubuntu4) ...
Setting up libdbd-mysql-perl (4.016-1) ...
Setting up mysql-client-core-5.1 (5.1.54-1ubuntu4) ...
Setting up mysql-client-5.1 (5.1.54-1ubuntu4) ...
Setting up mysql-server-core-5.1 (5.1.54-1ubuntu4) ...
Setting up mysql-server-5.1 (5.1.54-1ubuntu4) ...
locale: Cannot set LC_CTYPE to default locale: No such file or directory
locale: Cannot set LC_MESSAGES to default locale: No such file or directory
locale: Cannot set LC_ALL to default locale: No such file or directory
mysql start/running, process 2201
Setting up libhtml-template-perl (2.9-2) ...
Setting up mysql-server (5.1.54-1ubuntu4) ...
Processing triggers for libc-bin ...
ldconfig deferred processing now taking place
dragon@usvm1104:~$
4) 登录mysql命令行测试一下 $ mysql -uroot -p
 Enter password: 
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 39
Server version: 5.1.54-1ubuntu4 (Ubuntu)

Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
This software comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to modify and redistribute it under the GPL v2 license

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
+--------------------+
2 rows in set (0.00 sec)

mysql>
5) 开启Mysql的远程访问 MySQL在Ubuntu中默认安装后,只能在本机访问,如果要开启远程访问,需做以下两个步骤: 1、修改配置文件,注释掉bind-address限制; $ sudo vi /etc/mysql/my.cnf 找到bind-address=127.0.0.1,把这一行注释掉; 2、添加远程用户: 先在本机用root登录到mysql,然后用grant命令添加用户,如: mysql> grant all privileges on 需要访问的db.* to 'newuser'@'%' indentified by 'password'; 然后执行如下命令重启mysql即可: $ service mysql restart
6) 其他参考 6-1) Mysql读取配置文件的顺序:/etc/my.cnf /etc/mysql/my.cnf /usr/etc/my.cnf ~/.my.cnf  默认安装后只有 /etc/mysql/my.cnf 这个配置文件 6-2) 查看用户在本机执行Mysql命令的历史记录:~$ cat .mysql_history 6-3) 修改MySQL数据文件存放路径: 修改/etc/mysql/my.cnf的datadir=/var/lib/mysql,默认路径为/var/lib/mysql 6-4) 修改MySQL的默认端口: 修改/etc/mysql/my.cnf的port=3306,默认端口为3306 6-5) 修改 MySQL 的管理员密码:$ sudo mysqladmin -u root password newpassword 6-6) 安装客户端:$ sudo apt-get install mysql-client 6-7) 检查 mysqld 进程是否已经开启:$ pgrep mysqld,如果进程开启,这个命令将会返回该进程的 id 6-8) 检查 MySQL 服务器是否正在运行: $ sudo netstat -tap | grep mysql 当您运行该命令时,您可以看到类似下面的行: tcp 0 0 localhost.localdomain:mysql *:* LISTEN - 如果服务器不能正常运行,您可以通过下列命令启动它:$ sudo /etc/init.d/mysql restart6-9) 查看mysql服务所使用的端口:$ sudo netstat -antup | grep mysql,将输出类似如下的信息 tcp        0      0 0.0.0.0:3306            0.0.0.0:*               LISTEN      682/mysqld
  • 1
  • 2
  • 下一页

相关内容