CentOS7安装mysql5.6.23 -(转)

一.下载glibc版本的Mysql

  mysql-advanced-5.6.23-linux-glibc2.5-x86_64.zip

  解压后,得到 mysql-advanced-5.6.23-linux-glibc2.5-x86_64.tar.gz

二.创建Mysql用户

adduser mysql
passwd mysql

  注意,glibc版本的Mysql,不是编译版的,是直接编译好的,相当于windows的绿色版

  CentOS默认yum源已经没有mysql-server了.而用mariadb代替,而2个数据库冲突,所以要安装mysql,要先卸载mariadb

  把mysql-advanced-5.6.23-linux-glibc2.5-x86_64.tar.gz上传到服务器

tar zxvf mysql-advanced-5.6.23-linux-glibc2.5-x86_64.tar.gz
mv mysql-advanced-5.6.23-linux-glibc2.5-x86_64 mysql5.6.23
cd mysql5.6.23
#初始化mysql数据库
scripts/mysql_install_db --user=mysql

三.开启mysql

bin/mysqld_safe --user=mysql

四.执行安全设置

CentOS7安装mysql5.6.23 -(转)
#bin/mysql_secure_installation

NOTE: 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 current
password for the root user. If you've just installed MySQL, and
you 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):<---输入现在的root密码,因为我们还没设置,直接回车
OK, successfully used password, moving on... Setting the root password ensures that nobody can log into the MySQL
root user without the proper authorisation. Set root password? [Y/n] Y <---是否设定root密码,当然设置了,输入Y回车
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 anyone
to log into MySQL without having to have a user account created for
them. This is intended only for testing, and to make the installation
go a bit smoother. You should remove them before moving into a
production environment. Remove anonymous users? [Y/n] Y <---是否删除匿名用户,删除,输入Y回车
... Success! Normally, root should only be allowed to connect from 'localhost'. This
ensures that someone cannot guess at the root password from the network. Disallow root login remotely? [Y/n] Y <---是否删禁止root用户远程登录,当然禁止,输入Y回车
... Success! By default, MySQL comes with a database named 'test' that anyone can
access. This is also intended only for testing, and should be removed
before moving into a production environment. Remove test database and access to it? [Y/n] <---是否删除测试数据库test,删除,输入Y回车
- Dropping test database...
... Success!
- Removing privileges on test database...
... Success! Reloading the privilege tables will ensure that all changes made so far
will take effect immediately. Reload privilege tables now? [Y/n] Y <---刷新权限,输入Y回车
... Success! Cleaning up... All done! If you've completed all of the above steps, your MySQL
installation should now be secure. Thanks for using MySQL!
CentOS7安装mysql5.6.23 -(转)

常用命令

#关闭mysql
mysqladmin shutdown
#或
mysqladmin -uroot -p shutdown 转自:http://www.cnblogs.com/kreo/p/4392090.html
上一篇:Linux几大服务


下一篇:Mysql,zip格式安装、修改密码、建库