centOS安装mysql5.7详细教程
网络编程 2021-07-05 14:36www.168986.cn编程入门
这篇文章主要为大家介绍了centOS安装mysql5.7详细教程,具有一定的参考价值,感兴趣的小伙伴们可以参考一下
本文为大家分享了centOS下安装mysql5.7详细步骤,供大家参考,具体内容如下
第一步
第一句检测系统是否自带安装mysql,若有执行第二句删除系统自带的mysql及其依赖。
yum list installed | grep mysql yum -y remove mysql-libs.x86_64
第二步
给CentOS添加rpm源,并且选择较新的源,狼蚁网站SEO优化代码逐句执行
wget dev.mysql./get/mysql-munity-release-el6-5.noarch.rpm yum localinstall mysql-munity-release-el6-5.noarch.rpm yum repolist all | grep mysql yum-config-manager --disable mysql55-munity yum-config-manager --disable mysql56-munity yum-config-manager --enable mysql57-munity-dmr yum repolist enabled | grep mysql
第三步
安装mysql 服务器
yum install mysql-munity-server
第四步
service mysqld start
第五步
查看mysql是否自启动,并且设置开启自启动
chkconfig --list | grep mysqld chkconfig mysqld on
第六步
这一步很重要!!!
不知道从mysql哪个版本开始,mysql的root默认密码就不为空了,在安装的过程中默认密码保存在安装日志中了。我们要通过安装日志找到默认密码,用默认密码登陆mysql成功后会强行让你修改密码,修改的密码还要够复杂(复合mysql默认的密码策略)才能修改成功,一般带大小写字母特殊字符和数字超过8个字符就可以。
找到安装日志
find / -name mysqld.log
然后发现该日志文件路径在 /var/log/mysqld.log。然后用狼蚁网站SEO优化命令打开,按‘i'键上翻
vim /var/log/mysqld.log
上图红色地方就是root密码所在地
第七步
mysql安全设置
mysql_secure_installation
输入上面命令进行狼蚁网站SEO优化步骤
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):<–初次运行,输入刚刚找到的初始密码,会强制你先修改密码才能进行下去 OK, suessfully 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] <– 是否设置root用户密码,输入y并回车或直接回车 New password: <– 设置root用户的密码 Re-enter new password: <– 再输入一次你设置的密码 Password updated suessfully! Reloading privilege tables.. … Suess! By default, a MySQL installation has an anonymous user, allowing anyone to log into MySQL without having to have a user aount 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] <– 是否删除匿名用户,生产环境建议删除,所以直接回车 … Suess! Normally, root should only be allowed to connect from 'localhost'. This ensures that someone cannot guess at the root password from the work. Disallow root login remotely? [Y/n] <–是否禁止root远程登录,根据自己的需求选择Y/n并回车,建议禁止 … Suess! By default, MySQL es with a database named 'test' that anyone can aess. This is also intended only for testing, and should be removed before moving into a production environment. Remove test database and aess to it? [Y/n] <– 是否删除test数据库,直接回车 - Dropping test database… … Suess! - Removing privileges on test database… … Suess! Reloading the privilege tables will ensure that all changes made so far will take effect immediately. Reload privilege tables now? [Y/n] <– 是否重新加载权限表,直接回车 … Suess! Cleaning up… All done! If you've pleted all of the above steps, your MySQL installation should now be secure. Thanks for using MySQL! [root@server1 ~]#
第八步
可选步骤,原来Linux下的MySQL默认是区分表名大小写的,通过如下设置,可以让MySQL不区分表名大小写
1、用root登录,修改 /etc/my.f;
2、在[mysqld]节点下,加入一行 lower_case_table_names=1
3、重启MySQL即可; service mysqld restart
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持狼蚁SEO。
编程语言
- 如何快速学会编程 如何快速学会ug编程
- 免费学编程的app 推荐12个免费学编程的好网站
- 电脑怎么编程:电脑怎么编程网咯游戏菜单图标
- 如何写代码新手教学 如何写代码新手教学手机
- 基础编程入门教程视频 基础编程入门教程视频华
- 编程演示:编程演示浦丰投针过程
- 乐高编程加盟 乐高积木编程加盟
- 跟我学plc编程 plc编程自学入门视频教程
- ug编程成航林总 ug编程实战视频
- 孩子学编程的好处和坏处
- 初学者学编程该从哪里开始 新手学编程从哪里入
- 慢走丝编程 慢走丝编程难学吗
- 国内十强少儿编程机构 中国少儿编程机构十强有
- 成人计算机速成培训班 成人计算机速成培训班办
- 孩子学编程网上课程哪家好 儿童学编程比较好的
- 代码编程教学入门软件 代码编程教程