linux 安装mysql文件

来源:互联网 发布:为知笔记产品经理 招聘 编辑:程序博客网 时间:2024/04/26 23:45

在RedHat 6.3下安装MySQL-server-5.6.13-1.el6.x86_64.rpm

首先下载下面三个文件:

MySQL-client-5.6.13-1.el6.x86_64.rpm
MySQL-server-5.6.13-1.el6.x86_64.rpm

然后使用root账号登陆,进行安装:

  1. 安装server、client:1. 安装server、client:

rpm -ivh –replacefiles MySQL-s*.rpm

rpm -ivh –replacefiles MySQL-c*.rpm

[root@localhost download]# rpm -ivh –replacefiles MySQL-server-5.6.13-1.el6.x86_64.rpm
Preparing… ########################################### [100%]
1:MySQL-server ########################################### [100%]
[root@localhost download]# rpm -ivh –replacefiles MySQL-client-5.6.13-1.el6.x86_64.rpm
Preparing… ########################################### [100%]
1:MySQL-client ########################################### [100%]

要移除安装可以使用 rpm -e MySQL-server 、 rpm -e MySQL-devel、MySQL-client即可;

  1. 初始化数据库:

/usr/bin/mysql_install_db

  1. 启动mysql服务:

service mysql start

使用命令ps -ef | grep mysql 查看mysql进程:

[root@localhost ~]# ps -ef | grep mysql
root 26047 1 0 18:14 pts/12 00:00:00 /bin/sh /usr/bin/mysqld_safe –datadir=/var/lib/mysql –pid-file=/var/lib/mysql/localhost.localdomain.pid
mysql 26227 26047 0 18:14 pts/12 00:00:01 /usr/sbin/mysqld –basedir=/usr –datadir=/var/lib/mysql –plugin-dir=/usr/lib64/mysql/plugin –user=mysql –log-error=/var/log/mysqld.log –pid-file=/var/lib/mysql/localhost.localdomain.pid –socket=/var/lib/mysql/mysql.sock
root 26545 24726 0 18:27 pts/8 00:00:00 grep mysql

4.设置root密码:

mysql> use mysql
Database changed
mysql>update user set Password = PASSWORD(‘123456’) where User =’root’;
mysql> flush privileges;
mysql> exit;
Query OK, 0 rows affected (0.15 sec)
Rows matched: 5 Changed: 0 Warnings: 0

mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)

退出,重新登陆即可使用新的密码登陆;

5.远程连接mysql权限
mysql>
GRANT ALL PRIVILEGES ON . TO ‘root’@’%’ IDENTIFIED BY ‘123456’ WITH GRANT OPTION;
mysql> flush privileges;
mysql> exit;

0 0