MySQL Forums
Forum List  »  General

how to get sysdate() via mysql> ?
Posted by: Karen Goh
Date: February 27, 2019 11:20PM

I have tried to get the sysdate() using mysql prompt without avail.

Please let me know which part of my work is wrong.

C:\Program Files\MySQL\MySQL Server 8.0.15\bin>mysql -u root -p
Enter password: ********
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 9
Server version: 8.0.15 MySQL Community Server - GPL

Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> mysql sysdate();
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 'mysql sysdate()' at line 1
mysql> SYSDATE();
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 'SYSDATE()' at line 1
mysql> CURRENT_TIMESTAMP
-> now();
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 'CURRENT_TIMESTAMP
now()' at line 1
mysql> now()
-> sysdate()
-> mysql now()
-> mysql now();
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 'now()
sysdate()
mysql now()
mysql now()' at line 1
mysql> run now();
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 'run now()' at line 1
mysql> use mysql
Database changed
mysql> sysdate()
-> mysql sysdate()
-> mysql sysdate();
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 'sysdate()
mysql sysdate()
mysql sysdate()' at line 1

Options: ReplyQuote


Subject
Written By
Posted
how to get sysdate() via mysql> ?
February 27, 2019 11:20PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.