Phpstudy upgrading MySQL to mysql5.7

Source: Internet
Author: User

Objective

I found a mistake at work today and always error when I go to the local data sheet:

?
1 [Err] 1294 - Invalid ON UPDATE clause for ‘字段名‘ column

Data table field for error:

?
1 `字段名` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP

Colleagues say the same SQL file can lead to success. Guess the database version of the problem, the colleague is 5.6, I checked the local database version is 5.5.53. Online check, sure enough is the version of the problem, 5.5 and 5.6 in timestemp behavior is different, 5.6.5 previous version does not support multiple current_timestamp default values.

Since the local integration environment is Phpstudy 2016, there is no option to upgrade the MySQL version, so upgrade yourself.

Download the high version of MySQL from the official website:

Official website: https://dev.mysql.com/downloads/file/?id=467269

Baidu Cloud Disk Address: Https://pan.baidu.com/s/1mi4UHtA

The selected version is 5.7.17 (later found that the 5.7 version of the installation, the system table fields, etc. are different from the previous version).

Steps:

First, back up the original Phpstudy MySQL installation directory

Second, extract the downloaded MySQL compressed files to the MySQL directory under Phpstudy, copy the My-default.ini, and rename it to My.ini.

Open the My.ini and locate the editor at #basedir:

?
12 basedir=D:/phpStudy/MySQLdatadir=D:/phpStudy/MySQL/data

Third, add the MySQL installation path to the system environment variable

Iv. Enter the MySQL bin directory under cmd (my is D:/phpstudy/mysql/bin), execute:

?
1 mysqld --initialize

Initializing the database

Five, Installation Services:

?
1 mysqld -install

Start the service:

?
1 net start MySQL

Six, log in MySQL error at this time:

?
123 C:\Users\dell>mysql -uroot -pEnter password: ****ERROR 1045 (28000): Access denied for user ‘root‘@‘localhost‘ (using password: YES)

Try to modify the root user password:

Open My.ini, find [mysqld], add below:

?
1 skip-grant-tables

At this point, use the root account, enter the password at the login.

Change Password:

?
12 mysql>update mysql.user set authentication_string=password(‘new_password‘) where user=‘root‘ and Host =‘localhost‘mysql> ALTER USER USER() IDENTIFIED BY ‘news_password‘;

Refresh permissions:

?
1 FLUSH PRIVILEGES;

Comment out the my.ini that you just added

?
1 skip-grant-tables

Log in again.

View the MySQL version at this time:

?
123456 mysql> select version();+-----------+| version() |+-----------+| 5.7.17  |+-----------+

Vii. problems arise:
After installing the Phpstudy, after upgrading the MySQL, through phpstudy boot, Apache can start, MySQL cannot start.

Workaround:
Previously installed MySQL, to the system service inside the MySQL delete, leave Mysqla service.
Under cmd command line input: SC delete MySQL can be deleted.

Phpstudy upgrading MySQL to mysql5.7

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.