Linux CenterOS安装mysql-5.6.12-linux-glibc2.5-x86_64.tar.gz
2015-12-04 11:20
603 查看
1.准备安装包,放到 /usr/local/
百度云盘分享:mysql-5.6.12-linux-glibc2.5-x86_64.tar.gz 链接:http://pan.baidu.com/s/1i3pWxKx 密码:t51u
[root@cnpc02 ~]# cd/usr/local/
1.1解压安装包
[root@cnpc02 local]#tar zxvf mysql-5.6.12-linux-glibc2.5-x86_64.tar.gz
重命名
[root@cnpc02 local]#mv mysql-5.6.12-linux-glibc2.5-x86_64 mysql
1.2 安装 辅助软件 yum -y install perl perl-devel
2.添加用户
[root@cnpc02 local]#groupadd mysql
[root@cnpc02 local]#useradd -r -g mysql mysql
3.修改目录权限
[root@cnpc02 local]#chown -R mysql.mysql /usr/local/mysql
4.初始化数据库
[root@cnpc02scripts]# /usr/local/mysql/scripts/mysql_install_db --user=mysql--basedir=/usr/local/mysql --datadir=/usr/local/mysql/data
5.注册服务
[root@cnpc02scripts]# cp /usr/local/mysql//support-files/mysql.server/etc/rc.d/init.d/mysql
[root@cnpc02scripts]# cp /usr/local/mysql/support-files/my-default.cnf /etc/my.cnf
cp: overwrite `/etc/my.cnf'? Y (最好配置为默认配置)
[root@cnpc02scripts]# chkconfig --add mysql
[root@cnpc02scripts]# chkconfig mysql on
6.启动服务
[root@cnpc02scripts]# service mysql start
Starting MySQL. SUCCESS!(初次启动完成)
7.添加环境变量,可以略过。当然这样做会更方便报告mysql相关命令,也可以不添加,但每次执行命令要切换到/usr/local/mysql/bin目录或者加上绝对路径执行命令,个人觉得比较费事……
[root@cnpc02 mysql]#vi /etc/profile
exportMYSQL_HOME=/usr/local/mysql
exportPATH=$PATH:$MYSQL_HOME/bin
[root@cnpc02 mysql]#source /etc/profile
8.修改管理员密码,默认为空,所以最好修改,格式如下
[root@cnpc02 bin]#mysqladmin -u root password 'new-password'
[root@cnpc02 bin]#/usr/local/mysql/bin/mysqladmin -u root password 'new-password'(没有添加环境变量使用)
9.默认安装完成,如果考虑到安全问题,需要安全安装执行命令/usr/local/mysql/bin/mysql_secure_installation,按照提示一步步往下走,关键位置我都做了注释。
[root@cnpc02 bin]#/usr/local/mysql/bin/mysql_secure_installation
NOTE: RUNNING ALLPARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQL
SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!
In order to log intoMySQL to secure it, we'll need the current
password for theroot user. If you've just installedMySQL, and
you haven't set theroot password yet, the password will be blank,
so you should justpress enter here.
Enter currentpassword for root (enter for none):
ERROR 1045 (28000):Access denied for user 'root'@'localhost' (using password: YES)
Enter currentpassword for root (enter for none):
OK, successfullyused password, moving on...
Setting the rootpassword ensures that nobody can log into the MySQL
root user withoutthe proper authorisation.
You already have a root passwordset, so you can safely answer 'n'.
Change the root password?[Y/n] n(如果你已经修改了root密码就输入n)
... skipping.
By default, a MySQLinstallation has an anonymous user, allowing anyone
to log into MySQLwithout having to have a user account created for
them. This is intended only for testing, and tomake the installation
go a bitsmoother. You should remove them beforemoving into a
productionenvironment.
Remove anonymous users?[Y/n] y(移除其它匿名用户,最好移除)
... Success!
Normally, rootshould only be allowed to connect from 'localhost'. This
ensures that someonecannot guess at the root password from the network.
Disallow root login remotely? [Y/n] y(是否允许远程连接,根据需要选择)
... Success!
By default, MySQLcomes with a database named 'test' that anyone can
access. This is also intended only for testing, andshould be removed
before moving into aproduction environment.
Remove test database andaccess to it? [Y/n] n(是否需要移除mysql自带的test库,随意。。)
... skipping.
Reloading theprivilege tables will ensure that all changes made so far
will take effectimmediately.
Reload privilege tables now?[Y/n] y(上面已做了修改是否重新加载权限表,当然y)
... Success!
All done! If you've completed all of the above steps,your MySQL
installation shouldnow be secure.
Thanks for using MySQL!(OK初步完成,打开试试吧!)
Cleaning up...
10.连接mysql
[root@cnpc02 bin]#mysql -u root -p
Enter password:
Welcome to the MySQLmonitor. Commands end with ; or \g.
Your MySQLconnection id is 10
Server version:5.6.12 MySQL Community Server (GPL)
Copyright (c) 2000,2013, Oracle and/or its affiliates. All rights reserved.
Oracle is aregistered trademark of Oracle Corporation and/or its
affiliates. Othernames may be trademarks of their respective
owners.
Type 'help;' or '\h'for help. Type '\c' to clear the current input statement.
mysql> show databases;(查看所有数据库)
+--------------------+
| Database |
+--------------------+
| information_schema|
| mysql |
| performance_schema|
| test |
+--------------------+
4 rows in set (0.05sec)
mysql>
到此大功告成!
百度云盘分享:mysql-5.6.12-linux-glibc2.5-x86_64.tar.gz 链接:http://pan.baidu.com/s/1i3pWxKx 密码:t51u
[root@cnpc02 ~]# cd/usr/local/
1.1解压安装包
[root@cnpc02 local]#tar zxvf mysql-5.6.12-linux-glibc2.5-x86_64.tar.gz
重命名
[root@cnpc02 local]#mv mysql-5.6.12-linux-glibc2.5-x86_64 mysql
1.2 安装 辅助软件 yum -y install perl perl-devel
2.添加用户
[root@cnpc02 local]#groupadd mysql
[root@cnpc02 local]#useradd -r -g mysql mysql
3.修改目录权限
[root@cnpc02 local]#chown -R mysql.mysql /usr/local/mysql
4.初始化数据库
[root@cnpc02scripts]# /usr/local/mysql/scripts/mysql_install_db --user=mysql--basedir=/usr/local/mysql --datadir=/usr/local/mysql/data
5.注册服务
[root@cnpc02scripts]# cp /usr/local/mysql//support-files/mysql.server/etc/rc.d/init.d/mysql
[root@cnpc02scripts]# cp /usr/local/mysql/support-files/my-default.cnf /etc/my.cnf
cp: overwrite `/etc/my.cnf'? Y (最好配置为默认配置)
[root@cnpc02scripts]# chkconfig --add mysql
[root@cnpc02scripts]# chkconfig mysql on
6.启动服务
[root@cnpc02scripts]# service mysql start
Starting MySQL. SUCCESS!(初次启动完成)
7.添加环境变量,可以略过。当然这样做会更方便报告mysql相关命令,也可以不添加,但每次执行命令要切换到/usr/local/mysql/bin目录或者加上绝对路径执行命令,个人觉得比较费事……
[root@cnpc02 mysql]#vi /etc/profile
exportMYSQL_HOME=/usr/local/mysql
exportPATH=$PATH:$MYSQL_HOME/bin
[root@cnpc02 mysql]#source /etc/profile
8.修改管理员密码,默认为空,所以最好修改,格式如下
[root@cnpc02 bin]#mysqladmin -u root password 'new-password'
[root@cnpc02 bin]#/usr/local/mysql/bin/mysqladmin -u root password 'new-password'(没有添加环境变量使用)
9.默认安装完成,如果考虑到安全问题,需要安全安装执行命令/usr/local/mysql/bin/mysql_secure_installation,按照提示一步步往下走,关键位置我都做了注释。
[root@cnpc02 bin]#/usr/local/mysql/bin/mysql_secure_installation
NOTE: RUNNING ALLPARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQL
SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!
In order to log intoMySQL to secure it, we'll need the current
password for theroot user. If you've just installedMySQL, and
you haven't set theroot password yet, the password will be blank,
so you should justpress enter here.
Enter currentpassword for root (enter for none):
ERROR 1045 (28000):Access denied for user 'root'@'localhost' (using password: YES)
Enter currentpassword for root (enter for none):
OK, successfullyused password, moving on...
Setting the rootpassword ensures that nobody can log into the MySQL
root user withoutthe proper authorisation.
You already have a root passwordset, so you can safely answer 'n'.
Change the root password?[Y/n] n(如果你已经修改了root密码就输入n)
... skipping.
By default, a MySQLinstallation has an anonymous user, allowing anyone
to log into MySQLwithout having to have a user account created for
them. This is intended only for testing, and tomake the installation
go a bitsmoother. You should remove them beforemoving into a
productionenvironment.
Remove anonymous users?[Y/n] y(移除其它匿名用户,最好移除)
... Success!
Normally, rootshould only be allowed to connect from 'localhost'. This
ensures that someonecannot guess at the root password from the network.
Disallow root login remotely? [Y/n] y(是否允许远程连接,根据需要选择)
... Success!
By default, MySQLcomes with a database named 'test' that anyone can
access. This is also intended only for testing, andshould be removed
before moving into aproduction environment.
Remove test database andaccess to it? [Y/n] n(是否需要移除mysql自带的test库,随意。。)
... skipping.
Reloading theprivilege tables will ensure that all changes made so far
will take effectimmediately.
Reload privilege tables now?[Y/n] y(上面已做了修改是否重新加载权限表,当然y)
... Success!
All done! If you've completed all of the above steps,your MySQL
installation shouldnow be secure.
Thanks for using MySQL!(OK初步完成,打开试试吧!)
Cleaning up...
10.连接mysql
[root@cnpc02 bin]#mysql -u root -p
Enter password:
Welcome to the MySQLmonitor. Commands end with ; or \g.
Your MySQLconnection id is 10
Server version:5.6.12 MySQL Community Server (GPL)
Copyright (c) 2000,2013, Oracle and/or its affiliates. All rights reserved.
Oracle is aregistered trademark of Oracle Corporation and/or its
affiliates. Othernames may be trademarks of their respective
owners.
Type 'help;' or '\h'for help. Type '\c' to clear the current input statement.
mysql> show databases;(查看所有数据库)
+--------------------+
| Database |
+--------------------+
| information_schema|
| mysql |
| performance_schema|
| test |
+--------------------+
4 rows in set (0.05sec)
mysql>
到此大功告成!
相关文章推荐
- 改变mysql的data目录-centos测试通过
- Solaris 11配置IPS安装系统包(类似linux中的yum源)
- Linux 设置用户登录超时
- Linux rpm 软件包管理命令
- centos7安装android sdk时报错Unable to run mksdcard SDK tool.
- centos 相关
- 虚拟机下安装Red Hat Linux
- linux vi编辑常用命令
- CentOS更换163的yum源
- Linux 下安装matlab2014a
- Linux中设置服务自启动的三种方式
- Linux系统服务及其配置
- CentOS6.5 安装Python3.5
- linux如何使用iptables进行本地端口转发
- linux下杀死进程(kill)的N种方法
- 【收藏帖】windows和Linux的数据类型对比
- linux下搭建生成HLS所需的.ts和.m3u8文件
- linux下面安装软件学习流程
- 交叉编译器简介以及ARM交叉编译器arm-linux-gcc
- 红帽老版本下载地址