加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 站长学院 > MySql教程 > 正文

新手一步一步教你在Linux下安装MySQL

发布时间:2020-12-12 02:17:22 所属栏目:MySql教程 来源:网络整理
导读:终于成功地在 linux 上面装上 mysql 了。兴奋之余写了这篇东西来纪念一下,顺便做个笔记,以便以后遇到问题时可以查阅。 首先看看安装需要用到的所有的包吧。 [root@localhost6 mysql]# ls mysql-5.0.37-2.fc7.i386.rpm mysql-server-5.0.37-2.fc7.i386.rpm
     终于成功地在linux上面装上mysql了。兴奋之余写了这篇东西来纪念一下,顺便做个笔记,以便以后遇到问题时可以查阅。

首先看看安装需要用到的所有的包吧。

[root@localhost6 mysql]# ls

mysql-5.0.37-2.fc7.i386.rpm mysql-server-5.0.37-2.fc7.i386.rpm unixODBC-2.2.12-2.fc7.i386.rpm

mysql-connector-odbc-3.51.12-2.2.i386.rpm perl-DBD-MySQL-3.0008-1.fc7.i386.rpm

mysql-libs-5.0.37-2.fc7.i386.rpm perl-DBI-1.53-2.fc7.i386.rpm

         接下来就是安装数据库的过程了。因为各个包都存在着一定的依赖关系的,所以大家在安装时最好按照我的安装顺序来安装,虽然我不敢说这个是唯一正确的顺序,但是至少是可行的一个按照顺序。

[root@localhost6 mysql]# rpm -ivh perl-DBI-1.53-2.fc7.i386.rpm

warning: perl-DBI-1.53-2.fc7.i386.rpm: Header V3 DSA signature: NOKEY,key ID 4f2a6fd2

Preparing... ########################################### [100%]

1:perl-DBI ########################################### [100%]

[root@localhost6 mysql]# rpm -ivh perl-DBD-MySQL-3.0008-1.fc7.i386.rpm

warning: perl-DBD-MySQL-3.0008-1.fc7.i386.rpm: Header V3 DSA signature: NOKEY,serif">1:perl-DBD-MySQL ########################################### [100%]

[root@localhost6 mysql]# rpm -ivh mysql-libs-5.0.37-2.fc7.i386.rpm

warning: mysql-libs-5.0.37-2.fc7.i386.rpm: Header V3 DSA signature: NOKEY,serif">1:mysql-libs ########################################### [100%]

[root@localhost6 mysql]# rpm -ivh mysql-5.0.37-2.fc7.i386.rpm

warning: mysql-5.0.37-2.fc7.i386.rpm: Header V3 DSA signature: NOKEY,serif">1:mysql ########################################### [100%]

[root@localhost6 mysql]# rpm -ivh mysql-server-5.0.37-2.fc7.i386.rpm

warning: mysql-server-5.0.37-2.fc7.i386.rpm: Header V3 DSA signature: NOKEY,serif">1:mysql-server ########################################### [100%]

        到此为止,整个mysql已经安装完成了。接下来是启动mysql的守护进程。过程大致如下

[root@localhost6 mysql]# chown -R mysql:mysql /var/lib/mysql

[root@localhost6 mysql]# /etc/init.d/mysqld start

初始化 MySQL 数据库: Installing all prepared tables

Fill help tables

To start mysqld at boot time you have to copy support-files/mysql.server

to the right place for your system

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 localhost6.localdomain6 password 'new-password'

See the manual for more instructions.

You can start the MySQL daemon with:

cd /usr ; /usr/bin/mysqld_safe &

You can test the MySQL daemon with the benchmarks in the 'sql-bench' directory:

cd sql-bench ; perl run-all-tests

Please report any problems with the /usr/bin/mysqlbug script!

The latest information about MySQL is available on the web at

http://www.mysql.com

Support MySQL by buying support/licenses at http://shop.mysql.com

[确定]

启动 MySQL]

        当你见到上面这个页面时,恭喜你,你安装成功了。现在你只要在终端输入mysql就可以使用了。我们来试试启动mysql来看看。

[root@localhost6 mysql]# mysql

Welcome to the MySQL monitor. Commands end with ; or g.

Your MySQL connection id is 2

Server version: 5.0.37 Source distribution

Type 'help;' or 'h' for help. Type 'c' to clear the buffer.

成功启动了。

mysql> quit;

Bye

退出成功。

        但是一般情况下要进行开发必然要用其他语言来连接mysql的,所以肯定要装odbc。安装过程如下。

[root@localhost6 mysql]# rpm -ivh unixODBC-2.2.12-2.fc7.i386.rpm

warning: unixODBC-2.2.12-2.fc7.i386.rpm: Header V3 DSA signature: NOKEY,serif">1:unixODBC ########################################### [100%]

[root@localhost6 mysql]# rpm -ivh mysql-connector-odbc-3.51.12-2.2.i386.rpm

warning: mysql-connector-odbc-3.51.12-2.2.i386.rpm: Header V3 DSA signature: NOKEY,serif">1:mysql-connector-odbc ########################################### [100%]

         odbc也安装成功。现在你就可以使用了mysql来进行开发了。至于怎么设置和使用,那就要看你自己对mysql的掌握程度了,我不在这献丑了。希望这篇文章能够帮助到其他和我一样的菜鸟吧。

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读