1 |
mysql -h seenual.com -u username -p database |
The arguments are
-h
followed by the server host name (seenual.com)-u
followed by the account user name (use your MySQL username)-p
which tells mysql
to prompt for a passworddatabase
the name of the database (use your database name).Once mysql
is running, you can type SQL statements and see the output in the terminal window.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
mysql> select * from systems; +-------+--------+-----------+ | name | oscode | ownercode | +-------+--------+-----------+ | blue | 1 | 2 | | red | 2 | 2 | | green | 3 | 1 | | brown | 2 | 3 | +-------+--------+-----------+ 4 rows in set (0.00 sec) mysql> select s.name, o.osname, p.pname from systems s, opsystem o, people p -> where s.oscode=o.oscode and s.ownercode = p.pcode; +-------+---------+--------+ | name | osname | pname | +-------+---------+--------+ | green | MacOSX | John | | blue | Windows | Jane | | red | Linux | Jane | | brown | Linux | Arthur | +-------+---------+--------+ 4 rows in set (0.03 sec) mysql> |
ดูเพิ่มเติม
https://docs.cs.cf.ac.uk/notes/accessing-mysql-from-linux/
https://www.linode.com/docs/databases/mysql/install-and-configure-mysql-workbench-on-ubuntu/
https://stackoverflow.com/questions/25657596/how-to-set-up-gui-on-amazon-ec2-ubuntu-server