php study 升级,PHP study 升级默认的MYSQL版本 为5.7

前言:由于项目需求,本地开发环境使用了phpstudy 的默认集成环境,但是由于其自带的mysql只是5.5的版本。在laravel 应用中显得尤为不足,而且这段时间需要学习laracms 其本身要求的数据库就需要达到5.7没办法只能升级。看了网上很多的教程和方法,前期总是很好的,但是每次重启的时候都会报无法连接本地的错误。

Can't connect to MySQL server on localhost (10061)

于是只能是慢慢地摸索和找方法,终于找到了解决方式,并为此记录下来。分享给有需要的朋友。

1.备份原来的MySQL文件夹phpstudy\PHPTutorial\MySQL重命名为MySQL5.5 2.将下载的mysql5.7压缩文件解压缩,并放在phpstudy\PHPTutorial\文件夹下,命名为MySQL; 3.将目录下的my-default.ini修改为my.ini (这里本人尝试过把原有的ini文件直接放进去,但是在启动的时候就是不停地报错。)

我设置的my.ini,有需要的可以直接粘贴复制使用,后期请自行重新根据各自的项目进行重新配置

# For advice on how to change settings please see

# http://dev.mysql.com/doc/refman/5.7/en/server-configuration-defaults.html

# *** DO NOT EDIT THIS FILE. It's a template which will be copied to the

# *** default location during install, and will be replaced if you

# *** upgrade to a newer version of MySQL.

[mysqld]

# Remove leading # and set to the amount of RAM for the most important data

# cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.

# innodb_buffer_pool_size = 128M

# Remove leading # to turn on a very important data integrity option: logging

# changes to the binary log between backups.

# log_bin

# These are commonly set, remove the # and set as required.

basedir="D:/phpstudy/PHPTutorial/MySQL/"

datadir="D:/phpstudy/PHPTutorial/MySQL/data/"

port=3306

# server_id = .....

# Remove leading # to set options mainly useful for reporting servers.

# The server defaults are faster for transactions and fast SELECTs.

# Adjust sizes as needed, experiment to find the optimal values.

# join_buffer_size = 128M

# sort_buffer_size = 2M

# read_rnd_buffer_size = 2M

#skip-grant-tables

sql-mode="NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"

max_connections=512

explicit_defaults_for_timestamp=true

4.以管理员身份运行cmd进入phpstudy\PHPTutorial\MySQL\bin目录;

运行 mysqld --install #此命令用于安装mysql运行后显示:Service successfully installed

5.运行 mysqld --initialize --user=root --console

运行后显示:

2018-11-26T05:30:06.207044Z 0 [Warning] InnoDB: New log files created, LSN=45790

2018-11-26T05:30:06.310050Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.

2018-11-26T05:30:06.340052Z 0 [Warning] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: 5524df0e-f13c-11e8-8811-1c6f65e86efe.

2018-11-26T05:30:06.343052Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.

2018-11-26T05:30:06.359053Z 1 [Note] A temporary password is generated for root@localhost: :5OVJr5WO

复制代码

其中(:5OVJr5WO

此时使用“net start mysql”成功启动msyql

net start mysql

MySQL 服务正在启动 .

MySQL 服务已经启动成功。

复制代码

登录成功后可以通过随机的账号密码对数据库进行登录

mysql -u root -p

Enter password: (输入生成的随机密码)

#登录后重新修改密码

set password=password('123456');

#到此在phpstudy下重新升级mysql完成

最后记得删除之前老的mysql版本

mysqld -remove

然后再phpstudy中重新安装服务就可以了

复制代码

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值