CentOS 6.5下安装MySQL 5.6
来源:互联网 发布:笔记本网卡mac地址修改 编辑:程序博客网 时间:2024/05/21 17:46
1、 下载
下载地址:
https://dev.mysql.com/downloads/mysql/5.6.html#downloads
选择你需要安装的版本,这里我的电脑是CentOs 6.5x64位
然后下载 RPM Bundle,这个是几个程序的合集包。
然后开始下载。。。。
2、 解压安装包
解压MySQL-5.6.37-1.el6.x86_64.rpm-bundle.tar
#tar -xvf MySQL-5.6.37-1.el6.x86_64.rpm-bundle.tar MySQL-embedded-5.6.37-1.el6.x86_64.rpm MySQL-shared-compat-5.6.37-1.el6.x86_64.rpm MySQL-server-5.6.37-1.el6.x86_64.rpm MySQL-test-5.6.37-1.el6.x86_64.rpm MySQL-devel-5.6.37-1.el6.x86_64.rpm MySQL-shared-5.6.37-1.el6.x86_64.rpm
#ls-rw-r--r--. 1 7155 31415 18894156 Jun 4 2017 MySQL-client-5.6.37-1.el6.x86_64.rpm-rw-r--r--. 1 7155 31415 3391760 Jun 4 2017 MySQL-devel-5.6.37-1.el6.x86_64.rpm-rw-r--r--. 1 7155 31415 90214216 Jun 4 2017 MySQL-embedded-5.6.37-1.el6.x86_64.rpm-rw-r--r--. 1 7155 31415 57482996 Jun 4 2017 MySQL-server-5.6.37-1.el6.x86_64.rpm-rw-r--r--. 1 7155 31415 1964816 Jun 4 2017 MySQL-shared-5.6.37-1.el6.x86_64.rpm-rw-r--r--. 1 7155 31415 3969752 Jun 4 2017 MySQL-shared-compat-5.6.37-1.el6.x86_64.rpm-rw-r--r--. 1 7155 31415 51776076 Jun 4 2017 MySQL-test-5.6.37-1.el6.x86_64.rpm
3、安装
卸载已安装的mysql-libs
# rpm -qa | grep -i mysqlmysql-libs-5.1.73-8.el6_8.x86_64#yum remove mysql-libs
安装
# rpm -ivh MySQL-shared-compat-5.6.37-1.el6.x86_64.rpm --force --nodeps # rpm -ivh MySQL-server-5.6.37-1.el6.x86_64.rpm warning: MySQL-server-5.6.37-1.el6.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEYPreparing... ########################################### [100%] 1:MySQL-server #################### ( 47%) ................... 2016-06-03 07:33:31 9531 [Note] InnoDB: Waiting for purge to start2016-06-03 07:33:31 9531 [Note] InnoDB: 5.6.37 started; log sequence number 0A random root password has been set. You will find it in '/root/.mysql_secret'.2016-06-03 07:33:32 9531 [Note] Binlog end2016-06-03 07:33:32 9531 [Note] InnoDB: FTS optimize thread exiting..............New default config file was created as /usr/my.cnf andwill be used by default by the server when you start it.You may edit this file to change server settings
安装日志里面有一句A random root password has been set. You will find it in ‘/root/.mysql_secret’.
安装时自动生成了随机密码,并保存在‘/root/.mysql_secret’,初次登录时需要重置密码。
# cat /root/.mysql_secretThe random password set for the root user at Fri Jun 3 07:33:32 2016 (local time): hbNyslmCsoidqRNd <- 得到root访问mysql的密码
安装客户端
# rpm -ivh MySQL-client-5.6.37-1.el6.x86_64.rpm --force --nodeps # rpm -ivh MySQL-devel-5.6.37-1.el6.x86_64.rpm --force --nodeps
MySQL 的配置文件位于:/usr/my.cnf ,根据需求修改配置
默认的datadir=/var/lib/mysql
启动mysql
# service mysql start
4、初始化
# mysql -u root -p Enter password: mysql>
输入初始密码后,就可以登录了;
登录后需要重置密码,如果不重置,则不让操作
mysql> show databases;ERROR 1820 (HY000): You must SET PASSWORD before executing this statement
这里可以直接使用命令修改root用户密码
SET PASSWORD = PASSWORD('passwd');
但MySQL提供了一个向导,推荐使用:
#/usr/bin/mysql_secure_installation --user=mysqlNOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQL SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!In order to log into MySQL to secure it, we'll need the currentpassword for the root user. If you've just installed MySQL, andyou haven't set the root password yet, the password will be blank,so you should just press enter here.Enter current password for root (enter for none): <- mysql的初始密码OK, successfully used password, moving on...Setting the root password ensures that nobody can log into the MySQLroot user without the proper authorisation.You already have a root password set, so you can safely answer 'n'.Change the root password? [Y/n] Y <- 是否更换root用户密码,建议更换New password: <- 设置root用户的密码Re-enter new password: <- 设置root用户的密码Password updated successfully!Reloading privilege tables.. ... Success!By default, a MySQL installation has an anonymous user, allowing anyoneto log into MySQL without having to have a user account created forthem. This is intended only for testing, and to make the installationgo a bit smoother. You should remove them before moving into aproduction environment.Remove anonymous users? [Y/n] Y <- 是否删除匿名用户,生产环境建议删除 ... Success!Normally, root should only be allowed to connect from 'localhost'. Thisensures that someone cannot guess at the root password from the network.Disallow root login remotely? [Y/n] Y <- 是否禁止root远程登录,根据自己的需求选择Y/n并回车,建议禁止 ... Success!By default, MySQL comes with a database named 'test' that anyone canaccess. This is also intended only for testing, and should be removedbefore moving into a production environment.Remove test database and access to it? [Y/n] n <- 是否删除test数据库,输入y并回车 ... skipping.Reloading the privilege tables will ensure that all changes made so farwill take effect immediately.Reload privilege tables now? [Y/n] Y <- 是否重新加载权限表,输入y并回车 ... Success!All done! If you've completed all of the above steps, your MySQLinstallation should now be secure.Thanks for using MySQL!Cleaning up...
5、创建用户
登录
# mysql -u root -p Enter password: mysql>
创建数据库,指定编码utf-8:
mysql> CREATE DATABASE db182915 DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
添加用户 test:
mysql> GRANT ALL PRIVILEGES ON db182915.* TO 'test'@'192.168.%' IDENTIFIED BY 'test123#' WITH GRANT OPTION;mysql> flush privileges;
阅读全文
0 0
- CentOS 6.5下安装MySQL 5.6.21
- CentOS 6.5下安装MySQL 5.6.21
- centOS 6.5 下安装MySQL 5.6.21
- CentOS 6.5下安装MySQL 5.6.35
- Centos 6.5下安装MySQL 5.6
- CentOS 6.5下二进制安装 MySQL 5.6
- CentOS 6.5下安装MySQL 5.6
- centos 6.5 下安装mysql
- centos 6.5 下安装 mysql
- centos 6.5 下安装mysql
- CentOS下安装mysql
- CentOS下安装mysql
- centos下安装mysql
- Centos下安装mysql
- centos下mysql安装
- centos下安装mysql
- centos下 mysql 安装
- centos 下安装mysql
- 区分大数据、数据分析与数据挖掘
- 详解C#中的反射
- C++单例模式的实现
- 关系型数据库和非关系型数据库
- from data请求ajax
- CentOS 6.5下安装MySQL 5.6
- Git远程操作详解
- 外观模式
- Java中boolean类型占用多少个字节
- Solr集群搭建
- CNN阴影去除--DeshadowNet: A Multi-context Embedding Deep Network for Shadow Removal
- 欢迎使用CSDN-markdown编辑器
- nginx+openssl配置https协议需要注意的问题
- 计算机考试干货,are you ready?