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:
?
Initializing the database
Five, Installation Services:
?
Start the service:
?
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:
?
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:
?
Comment out the my.ini that you just added
?
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