数据库技术:mysql安装包安装步骤(mysql安装教程详细教程) |
您所在的位置:网站首页 › mysql的安装包 › 数据库技术:mysql安装包安装步骤(mysql安装教程详细教程) |
数据库技术:mysql安装包安装步骤(mysql安装教程详细教程)
电脑图片
•
2022年4月14日 下午3:47
•
数据库干货教程 •
阅读 7
部署mysql5.7.251、下载rpm安装包。2、上传到服务器,解压。3、卸载之前的版本。4、按照顺序安装:rpm -ivh mysql-community-common-5.7.25-1.el7. 部署mysql5.7.251、下载rpm安装包。2、上传到服务器,解压。3、卸载之前的版本。4、按照顺序安装: rpm -ivh mysql-community-common-5.7.25-1.el7.x86_64.rpmrpm -ivh mysql-community-libs-5.7.25-1.el7.x86_64.rpmrpm -ivh mysql-community-devel-5.7.25-1.el7.x86_64.rpmrpm -ivh mysql-community-client-5.7.25-1.el7.x86_64.rpmrpm -ivh mysql-community-server-5.7.25-1.el7.x86_64.rpm 5、修改配置文件为无需密码登陆 vi /etc/my.cnf [mysqld]#下添加 skip-grant-tables=1 #不用验证,无需密码登陆6、修改默认字符集为utf8 vi /etc/my.cnf [mysqld]#下添加 character-set-server=utf8 collation-server=utf8_general_ci [mysql]#下添加 default-character-set=utf87、启动mysql systemctl start mysqld; 8、查看启动是否报错 systemctl status mysqld 9、【知识点】登陆mysql,默认已创建如下四个库。同时my.cnf中配置的datadir指定目录下存在如下四个库的文件夹。 ![]() 10、修改密码 mysql>use mysqlmysql>update user setmysql>authentication_string=password(‘123456’) ,mysql>password_expired=‘n’,password_last_changed=now()mysql>where user=‘root’;mysql>flush privileges;mysql> alter user ‘root’@‘localhost’ identified by ‘123456’;mysql>flush privileges;mysql>exit;同时my.cnf 删除参数skip-grant-tables=1,重启mysql:systemctl restart mysqld 。 11、测试是否可用 mysql -uroot -p -e “show databases;”;–安全起见-p不加密码 12、配置可被其他主机访问新增host为‘%’的用户: create user readonly@% identified by’readonly’;grant select on . toreadonly@%; 13、确认网络连通的前提,开放防火墙端口 firewall-cmd –zone=public –add-port=3306/tcp –permanent 14、重新启动防火墙 firewall-cmd –reload 卸载mysql5.7.251、卸载程序:由于存在依赖关系,故需要按如下顺序卸载 rpm -e mysql-community-server-5.7.25-1.el7.x86_64rpm -e mysql-community-devel-5.7.25-1.el7.x86_64rpm -e mysql-community-client-5.7.25-1.el7.x86_64rpm -e mysql-community-libs-5.7.25-1.el7.x86_64 2、清除余项 whereis mysqlrm -rf 相关文件 3、删除配置文件 rm -rf /etc/my.cnf* 4、删除默认datadir路径 rm –rf /var/lib/mysql 5、剩余配置检查:(此次操作如下无结果) chkconfig –list | grep -i mysqlchkconfig –del mysql 问题鉴赏1、关闭selinux报错: 2019-03-12t17:28:58.770891z 0 [error] innodb: operating system error number 13 in a file operation. 2019-03-12t17:28:58.770912z 0 [error] innodb: the error means mysqld does not have the access rights to the directory. 2019-03-12t17:28:58.770918z 0 [error] innodb: os_file_get_status() failed on './ibdata1'. can't determine file permissions 2019-03-12t17:28:58.770928z 0 [error] innodb: plugin initialization aborted with error generic error 2019-03-12t17:28:59.371503z 0 [error] plugin 'innodb' init function returned error. 2019-03-12t17:28:59.371548z 0 [error] plugin 'innodb' registration as a storage engine failed. 2019-03-12t17:28:59.371556z 0 [error] failed to initialize builtin plugins. 2019-03-12t17:28:59.371560z 0 [error] aborting解决方法:查看selinux状态:getenforce。关闭selinux:setenforce 0。2、修改密码后show databases报错 mysql>update mysql.user set authentication_string=password(‘* * *’) where user=’root’;mysql>flush privileges; 此时访问均正常。退出mysql,配置文件my.cnf 删除参数skip-grant-tables=1,重启mysql可使用密码重新登陆。登陆后执行指令: show databases; 报错error 1820 (hy000): you must reset your password using alter user statement before executin。解决方法: mysql>alter user ‘root’@‘localhost’ identified by ‘****’;mysql>flush privileges;mysql>show databases; 3、sql_mode参数赏析 需要了解更多数据库技术:mysql安装包安装步骤(mysql安装教程详细教程),都可以关注数据库技术分享栏目—猴子技术宅(www.ssfiction.com) my.cnf新增配置信息sql_mode=;重启mysql。 only_full_group_by:出现在select语句、having条件和order by语句中的列,必须是group by的列或者依赖于group by列的函数列。 no_auto_value_on_zero:该值影响自增长列的插入。默认设置下,插入0或null代表生成下一个自增长值。如果用户希望插入的值为0,而该列又是自增长的,那么这个选项就有用了。 strict_trans_tables:在该模式下,如果一个值不能插入到一个事务表中,则中断当前的操作,对非事务表不做限制 no_zero_in_date:这个模式影响了是否允许日期中的月份和日包含0。如果开启此模式,2016-01-00是不允许的,但是0000-02-01是允许的。它实际的行为受到 strict mode是否开启的影响1。 no_zero_date:设置该值,mysql数据库不允许插入零日期。它实际的行为受到 strictmode是否开启的影响2。 error_for_division_by_zero:在insert或update过程中,如果数据被零除,则产生错误而非警告。如果未给出该模式,那么数据被零除时mysql返回null no_auto_create_user:禁止grant创建密码为空的用户 no_engine_substitution:如果需要的存储引擎被禁用或未编译,那么抛出错误。不设置此值时,用默认的存储引擎替代,并抛出一个异常 pipes_as_concat:将”||”视为字符串的连接操作符而非或运算符,这和oracle数据库是一样的,也和字符串的拼接函数concat相类似 ansi_quotes:启用ansi_quotes后,不能用双引号来引用字符串,因为它被解释为识别符。本文来自网络收集,不代表猴子技术宅立场,如涉及侵权请点击右边联系管理员删除。 如若转载,请注明出处:https://www.ssfiction.com/sqljc/1078041.html MYSQL servermysql安装包安装步骤mysql安装教程详细教程mysql数据库数据库基础教程数据库技术 赞 (0) |
今日新闻 |
推荐新闻 |
CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3 |