Unable to run util.checkForServerUpgrade()

Hi,
I am trying to run util.checkForServerUpgrade and I get an error that I am using the incorrect syntax.

I’m sure its something simple but I am just trying to run the util.checkForServerUpgrade without any options and it says I have a syntax error.

[mysql@dvlb7mysqldb01 ~]$ mysqlsh root@localhost --socket=/var/lib/mysql/mysql.sock
MySQL Shell 8.4.1

Copyright (c) 2016, 2024, Oracle and/or its affiliates.
Oracle is a registered trademark of Oracle Corporation and/or its affiliates.
Other names may be trademarks of their respective owners.

Type ‘\help’ or ‘?’ for help; ‘\quit’ to exit.
Creating a Classic session to ‘root@/var%2Flib%2Fmysql%2Fmysql.sock’
Fetching global names for auto-completion… Press ^C to stop.
Your MySQL connection id is 11
Server version: 8.0.21-12 Percona Server (GPL), Release 12, Revision 7ddfdfe
No default schema selected; type \use to set one.
MySQL localhost SQL > \status
MySQL Shell version 8.4.1

Connection Id: 11
Current schema:
Current user: root@localhost
SSL: Not in use.
Using delimiter: ;
Server version: 8.0.21-12 Percona Server (GPL), Release 12, Revision 7ddfdfe
Protocol version: Classic 10
Client library: 8.4.2
Connection: Localhost via UNIX socket
Unix socket: /var/lib/mysql/mysql.sock
Server characterset: utf8
Schema characterset: utf8
Client characterset: utf8mb4
Conn. characterset: utf8mb4
Result characterset: utf8mb4
Compression: Disabled
Uptime: 13 min 10.0000 sec

Threads: 2 Questions: 25 Slow queries: 0 Opens: 141 Flush tables: 3 Open tables: 58 Queries per second avg: 0.031
MySQL localhost SQL > util.checkForServerUpgrade();
ERROR: 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘util.checkForServerUpgrade()’ at line 1

MySQL localhost SQL >

This line indicates you are in “SQL Mode”.

util.checkForServerUpgrade();

You need to switch to “Javascript mode” in order to use javascript functions. Type \js to switch.

1 Like

Hi @ipcmlr

Here is an example of a calling the function on mysqlsh 8.4.5

Thanks. Brain not working.
util.checkForServerUpgrade(); on the other is working. thanks.