欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  数据库

Linux安装MySql

程序员文章站 2022-03-20 10:07:06
...
本文记录Linux安装MySql过程。

环境:OS:Centos 6.5 x64 & MySql 5.1 x64

1、系统检查

检查是否已经安装MySql数据库。

[root@master ~]# rpm -qa | grep mysql

如果有安装,先卸载已经安装的MySql数据库。

[root@master ~]# rpm -e mysql  //普通删除模式[root@master ~]# rpm -e --nodeps mysql  //强力删除模式,如果使用上面命令删除时,提示有依赖的其它文件,则用该命令可以对其进行强力删除

2、安装数据库

[root@master ~]# yum install -y mysql-server mysql mysql-devel

查看安装情况

[root@master ~]# rpm -qi mysql-serverName: mysql-server Relocations: (not relocatable)Version : 5.1.73Vendor: CentOSRelease : 3.el6_5 Build Date: 2014年02月13日 星期四 03时42分39秒Install Date: 2014年04月17日 星期四 19时38分28秒Build Host: c6b9.bsys.dev.centos.orgGroup : Applications/DatabasesSource RPM: mysql-5.1.73-3.el6_5.src.rpmSize: 25882723 License: GPLv2 with exceptionsSignature : RSA/SHA1, 2014年02月13日 星期四 03时48分08秒, Key ID 0946fca2c105b9dePackager: CentOS BuildSystem URL : http://www.mysql.comSummary : The MySQL server and related filesDescription :MySQL is a multi-user, multi-threaded SQL database server. MySQL is aclient/server implementation consisting of a server daemon (mysqld)and many different client programs and libraries. This package containsthe MySQL server and some accompanying files and directories.

3、管理数据库

启动数据库

[root@master ~]# service mysqld start初始化 MySQL 数据库: Installing MySQL system tables...OKFilling help tables...OKTo start mysqld at boot time you have to copysupport-files/mysql.server to the right place for your systemPLEASE 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 master password 'new-password'Alternatively you can run:/usr/bin/mysql_secure_installationwhich will also give you the option of removing the testdatabases and anonymous user created by default.This isstrongly recommended for production servers.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 mysql-test-run.plcd /usr/mysql-test ; perl mysql-test-run.plPlease report any problems with the /usr/bin/mysqlbug script![确定]正在启动 mysqld: [确定]
相关标签: Linux 记录