linux(虛擬機器)下安裝MySQL

來源:互聯網
上載者:User

[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

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.