Linux 安装 MySQL

来源:互联网 发布:学c语言的网站 编辑:程序博客网 时间:2024/06/05 07:13

[root@localhost home]# tar -xvf MySQL-5.6.2_m5-1.rhel5.i386.tar
MySQL-client-5.6.2_m5-1.rhel5.i386.rpm
MySQL-devel-5.6.2_m5-1.rhel5.i386.rpm
MySQL-embedded-5.6.2_m5-1.rhel5.i386.rpm
MySQL-server-5.6.2_m5-1.rhel5.i386.rpm
MySQL-shared-5.6.2_m5-1.rhel5.i386.rpm
MySQL-test-5.6.2_m5-1.rhel5.i386.rpm
[root@localhost home]# ls
admin
lost+found
MySQL-5.6.2_m5-1.rhel5.i386.tar
MySQL-client-5.6.2_m5-1.rhel5.i386.rpm
MySQL-devel-5.6.2_m5-1.rhel5.i386.rpm
MySQL-embedded-5.6.2_m5-1.rhel5.i386.rpm
MySQL-server-5.6.2_m5-1.rhel5.i386.rpm
MySQL-shared-5.6.2_m5-1.rhel5.i386.rpm
MySQL-test-5.6.2_m5-1.rhel5.i386.rpm
vmware-tools-distrib
[root@localhost home]# rpm -ivh MySQL-server-5.6.2_m5-1.rhel5.i386.rpm
error: Failed dependencies:
        MySQL conflicts with mysql-5.0.77-4.el5_4.2.i386
        MySQL-server conflicts with mysql-server-5.0.77-4.el5_4.2.i386
[root@localhost home]# rpm -qa|grep -i mysql
mysql-5.0.77-4.el5_4.2
MySQL-python-1.2.1-1
mysql-connector-odbc-3.51.26r1127-1.el5
perl-DBD-MySQL-3.0007-2.el5
mysql-server-5.0.77-4.el5_4.2
libdbi-dbd-mysql-0.8.1a-1.2.2
[root@localhost home]# rpm -ev libdbi-dbd-mysql-0.8.1a-1.2.2
[root@localhost home]# rpm -qa|grep -i mysql
mysql-5.0.77-4.el5_4.2
MySQL-python-1.2.1-1
mysql-connector-odbc-3.51.26r1127-1.el5
perl-DBD-MySQL-3.0007-2.el5
mysql-server-5.0.77-4.el5_4.2
[root@localhost home]# rpm -ev mysql-server-5.0.77-4.el5_4.2
[root@localhost home]# rpm -qa|grep -i mysql
mysql-5.0.77-4.el5_4.2
MySQL-python-1.2.1-1
mysql-connector-odbc-3.51.26r1127-1.el5
perl-DBD-MySQL-3.0007-2.el5
[root@localhost home]# rpm -ev perl-DBD-MySQL-3.0007-2.el5
[root@localhost home]# rpm -qa|grep -i mysql
mysql-5.0.77-4.el5_4.2
MySQL-python-1.2.1-1
mysql-connector-odbc-3.51.26r1127-1.el5
[root@localhost home]# rpm -ev mysql-connector-odbc-3.51.26r1127-1.el5
[root@localhost home]# rpm -qa|grep -i mysql
mysql-5.0.77-4.el5_4.2
MySQL-python-1.2.1-1
[root@localhost home]# rpm -ev MySQL-python-1.2.1-1
[root@localhost home]# rpm -qa|grep -i mysql
mysql-5.0.77-4.el5_4.2
[root@localhost home]# rpm -ev mysql-5.0.77-4.el5_4.2
[root@localhost home]# rpm -ev mysql-5.0.77-4.el5_4.2
error: package mysql-5.0.77-4.el5_4.2 is not installed
[root@localhost home]# rpm -qa|grep -i mysql
[root@localhost home]# rm -f /etc/my.cnf
[root@localhost home]# rm -rf /var/lib/mysql
[root@localhost home]# ls
admin   lost+found                              MySQL-devel-5.6.2_m5-1.rhel5.i386.rpm     MySQL-server-5.6.2_m5-1.rhel5.i386.rpm 

MySQL-test-5.6.2_m5-1.rhel5.i386.rpm
CentOS  MySQL-client-5.6.2_m5-1.rhel5.i386.rpm  MySQL-embedded-5.6.2_m5-1.rhel5.i386.rpm  MySQL-shared-5.6.2_m5-1.rhel5.i386.rpm 

vmware-tools-distrib
[root@localhost home]# rpm -ivh MySQL-server-5.6.2_m5-1.rhel5.i386.rpm
Preparing...                ########################################### [100%]
   1:MySQL-server           ########################################### [100%]
110615 17:56:39 [Note] Binlog end
110615 17:56:39 [Note] Shutting down plugin 'partition'
110615 17:56:39 [Note] Shutting down plugin 'BLACKHOLE'
110615 17:56:39 [Note] Shutting down plugin 'ARCHIVE'
110615 17:56:39 [Note] Shutting down plugin 'INNODB_SYS_FOREIGN_COLS'
110615 17:56:39 [Note] Shutting down plugin 'INNODB_SYS_FOREIGN'
110615 17:56:39 [Note] Shutting down plugin 'INNODB_SYS_FIELDS'
110615 17:56:39 [Note] Shutting down plugin 'INNODB_SYS_COLUMNS'
110615 17:56:39 [Note] Shutting down plugin 'INNODB_SYS_INDEXES'
110615 17:56:39 [Note] Shutting down plugin 'INNODB_SYS_TABLESTATS'
110615 17:56:39 [Note] Shutting down plugin 'INNODB_SYS_TABLES'
110615 17:56:39 [Note] Shutting down plugin 'INNODB_METRICS'
110615 17:56:39 [Note] Shutting down plugin 'INNODB_BUFFER_POOL_STATS'
110615 17:56:39 [Note] Shutting down plugin 'INNODB_BUFFER_PAGE_LRU'
110615 17:56:39 [Note] Shutting down plugin 'INNODB_BUFFER_PAGE'
110615 17:56:39 [Note] Shutting down plugin 'INNODB_CMPMEM_RESET'
110615 17:56:39 [Note] Shutting down plugin 'INNODB_CMPMEM'
110615 17:56:39 [Note] Shutting down plugin 'INNODB_CMP_RESET'
110615 17:56:39 [Note] Shutting down plugin 'INNODB_CMP'
110615 17:56:39 [Note] Shutting down plugin 'INNODB_LOCK_WAITS'
110615 17:56:39 [Note] Shutting down plugin 'INNODB_LOCKS'
110615 17:56:39 [Note] Shutting down plugin 'INNODB_TRX'
110615 17:56:39 [Note] Shutting down plugin 'PERFORMANCE_SCHEMA'
110615 17:56:39 [Note] Shutting down plugin 'MEMORY'
110615 17:56:39 [Note] Shutting down plugin 'MyISAM'
110615 17:56:39 [Note] Shutting down plugin 'MRG_MYISAM'
110615 17:56:39 [Note] Shutting down plugin 'CSV'
110615 17:56:39 [Note] Shutting down plugin 'mysql_old_password'
110615 17:56:39 [Note] Shutting down plugin 'mysql_native_password'
110615 17:56:39 [Note] Shutting down plugin 'binlog'
110615 17:56:39 [Note] Binlog end
110615 17:56:39 [Note] Shutting down plugin 'partition'
110615 17:56:39 [Note] Shutting down plugin 'BLACKHOLE'
110615 17:56:39 [Note] Shutting down plugin 'ARCHIVE'
110615 17:56:39 [Note] Shutting down plugin 'INNODB_SYS_FOREIGN_COLS'
110615 17:56:39 [Note] Shutting down plugin 'INNODB_SYS_FOREIGN'
110615 17:56:39 [Note] Shutting down plugin 'INNODB_SYS_FIELDS'
110615 17:56:39 [Note] Shutting down plugin 'INNODB_SYS_COLUMNS'
110615 17:56:39 [Note] Shutting down plugin 'INNODB_SYS_INDEXES'
110615 17:56:39 [Note] Shutting down plugin 'INNODB_SYS_TABLESTATS'
110615 17:56:39 [Note] Shutting down plugin 'INNODB_SYS_TABLES'
110615 17:56:39 [Note] Shutting down plugin 'INNODB_METRICS'
110615 17:56:39 [Note] Shutting down plugin 'INNODB_BUFFER_POOL_STATS'
110615 17:56:39 [Note] Shutting down plugin 'INNODB_BUFFER_PAGE_LRU'
110615 17:56:39 [Note] Shutting down plugin 'INNODB_BUFFER_PAGE'
110615 17:56:39 [Note] Shutting down plugin 'INNODB_CMPMEM_RESET'
110615 17:56:39 [Note] Shutting down plugin 'INNODB_CMPMEM'
110615 17:56:39 [Note] Shutting down plugin 'INNODB_CMP_RESET'
110615 17:56:39 [Note] Shutting down plugin 'INNODB_CMP'
110615 17:56:39 [Note] Shutting down plugin 'INNODB_LOCK_WAITS'
110615 17:56:39 [Note] Shutting down plugin 'INNODB_LOCKS'
110615 17:56:39 [Note] Shutting down plugin 'INNODB_TRX'
110615 17:56:39 [Note] Shutting down plugin 'PERFORMANCE_SCHEMA'
110615 17:56:39 [Note] Shutting down plugin 'MEMORY'
110615 17:56:39 [Note] Shutting down plugin 'MyISAM'
110615 17:56:39 [Note] Shutting down plugin 'MRG_MYISAM'
110615 17:56:39 [Note] Shutting down plugin 'CSV'
110615 17:56:39 [Note] Shutting down plugin 'mysql_old_password'
110615 17:56:39 [Note] Shutting down plugin 'mysql_native_password'
110615 17:56:39 [Note] Shutting down plugin 'binlog'

PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:

/usr/bin/mysqladmin -u root password 'new-password'
/usr/bin/mysqladmin -u root -h localhost password 'new-password'

Alternatively you can run:
/usr/bin/mysql_secure_installation

which will also give you the option of removing the test
databases and anonymous user created by default.  This is
strongly recommended for production servers.

See the manual for more instructions.

Please report any problems with the /usr/bin/mysqlbug script!
[root@localhost home]# ls
admin   lost+found                              MySQL-devel-5.6.2_m5-1.rhel5.i386.rpm     MySQL-server-5.6.2_m5-1.rhel5.i386.rpm 

MySQL-test-5.6.2_m5-1.rhel5.i386.rpm
CentOS  MySQL-client-5.6.2_m5-1.rhel5.i386.rpm  MySQL-embedded-5.6.2_m5-1.rhel5.i386.rpm  MySQL-shared-5.6.2_m5-1.rhel5.i386.rpm 

vmware-tools-distrib
[root@localhost home]# rpm -ivh MySQL-client-5.6.2_m5-1.rhel5.i386.rpm
Preparing...                ########################################### [100%]
   1:MySQL-client           ########################################### [100%]
[root@localhost home]# rpm -ivh MySQL-devel-5.6.2_m5-1.rhel5.i386.rpm
Preparing...                ########################################### [100%]
   1:MySQL-devel            ########################################### [100%]
[root@localhost home]# netstat -antp
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address               Foreign Address             State       PID/Program name  
tcp        0      0 127.0.0.1:2208              0.0.0.0:*                   LISTEN      3649/hpiod         
tcp        0      0 0.0.0.0:648                 0.0.0.0:*                   LISTEN      3434/rpc.statd     
tcp        0      0 0.0.0.0:111                 0.0.0.0:*                   LISTEN      3402/portmap       
tcp        0      0 127.0.0.1:631               0.0.0.0:*                   LISTEN      2954/cupsd         
tcp        0      0 127.0.0.1:25                0.0.0.0:*                   LISTEN      3689/sendmail: acce
tcp        0      0 127.0.0.1:2207              0.0.0.0:*                   LISTEN      3654/python        
tcp        0      0 :::22                       :::*                        LISTEN      3667/sshd          
tcp        0      0 ::ffff:192.168.184.136:22   ::ffff:192.168.184.1:1385   ESTABLISHED 4107/sshd: root@not
tcp        0      0 ::ffff:192.168.184.136:22   ::ffff:192.168.184.1:1382   ESTABLISHED 4020/1             
[root@localhost home]# /etc/init.d/mysql start
Starting MySQL...                                          [纭甝
[root@localhost home]# netstat -antp
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address               Foreign Address             State       PID/Program name  
tcp        0      0 127.0.0.1:2208              0.0.0.0:*                   LISTEN      3649/hpiod         
tcp        0      0 0.0.0.0:648                 0.0.0.0:*                   LISTEN      3434/rpc.statd     
tcp        0      0 0.0.0.0:111                 0.0.0.0:*                   LISTEN      3402/portmap       
tcp        0      0 127.0.0.1:631               0.0.0.0:*                   LISTEN      2954/cupsd         
tcp        0      0 127.0.0.1:25                0.0.0.0:*                   LISTEN      3689/sendmail: acce
tcp        0      0 127.0.0.1:2207              0.0.0.0:*                   LISTEN      3654/python        
tcp        0      0 :::3306                     :::*                        LISTEN      5952/mysqld        
tcp        0      0 :::22                       :::*                        LISTEN      3667/sshd          
tcp        0      0 ::ffff:192.168.184.136:22   ::ffff:192.168.184.1:1385   ESTABLISHED 4107/sshd: root@not
tcp        0    144 ::ffff:192.168.184.136:22   ::ffff:192.168.184.1:1382   ESTABLISHED 4020/1             
[root@localhost home]# mysql
Welcome to the MySQL monitor.  Commands end with ; or /g.
Your MySQL connection id is 1
Server version: 5.6.2-m5 MySQL Community Server (GPL)

Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

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

mysql> quit
Bye
[root@localhost home]# /usr/bin/mysqladmin -u root password 123456
[root@localhost home]# mysql
Welcome to the MySQL monitor.  Commands end with ; or /g.
Your MySQL connection id is 3
Server version: 5.6.2-m5 MySQL Community Server (GPL)

Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

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

mysql> exit
Bye

原创粉丝点击