[原]linux(虚拟机)下安装MySQL
[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%]
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 -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 5
Server version: 5.5.16 MySQL Community Server (GPL)
Copyright (c) 2000, 2011, 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
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%]
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 -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 5
Server version: 5.5.16 MySQL Community Server (GPL)
Copyright (c) 2000, 2011, 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
作者:yuandianlws 发表于2011-10-24 10:38:08 原文链接
阅读:1048 评论:0 查看评论