Guide to MySQL Operations on Turing Server

Slide Note
Embed
Share

This guide provides step-by-step instructions on working with MySQL on Turing server at turing.csce.uark.edu. It includes logging in via SSH, connecting to the server, changing MySQL passwords, and performing operations on tables. Learn how to create tables, change passwords, and more with detailed images and explanations.


Uploaded on Jul 05, 2024 | 2 Views


Download Presentation

Please find below an Image/Link to download the presentation.

The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author. Download presentation by click this link. If you encounter any issues during the download, it is possible that the publisher has removed the file from their server.

E N D

Presentation Transcript


  1. MySQL Working on Turing

  2. Login to SSH Log on to turing.csce.uark.edu using your UARK username and password. Those who don't have the SSH client, can download that from university's IT site at http://software.uark.edu.

  3. Connecting to turing

  4. Enter your UARK password

  5. Login Screen of turing

  6. MySQL Login Screen Type mysql -u user_name -p EX: mysql u rsahu -p Enter your mysql password (in file .my.cnf in ~username)

  7. Login Prompt Screen of MySQL

  8. How to change MySQL password Users can have their own customized password to login to mysql After login to mysql, user should choose database then change the password of mysql that is prompted when user types mysql u user_name p 1. Change database mysql> USE user_name; 2. Update password mysql> SET PASSWORD FOR USER_NAME @ localhost =PASSWORD ( NEW_PASSWORD ); Example: SET PASSWORD FOR rsahu @ localhost = PASSWORD( TYPE_ANY_PASSWORD );

  9. 1. Change database mysql> USE rsahu; 2. Change password mysql> SET PASSWORD FOR rsahu @ localhost = PASSWORD ( NEW_PASSWORD );

  10. Operations on Table Before creating any table in mysql, you should choose the database. [ here you can only use the existing database, which is under user s UARK user_name] mysql> USE <uark_username> ; For ex: mysql> use rsahu; It will print a message saying Database Changed

  11. Create Table Mysql> CREATE TABLE table_name (columnname datatype[constraint [constraint name]] .); EX: CREATE TABLE Test1 (Test_Id Integer Primary Key, Test_name Char(5));

  12. Inserting Values Into Table If column list is present, the values to be inserted must match the number of type of the columns listed. If column list is not given, values for all the columns must be provided and it must match the column types. mysql> INSERT INTO table_name VALUES (column1_value, column2_value, . ); mysql> INSERT INTO Test1 VALUES ( 1, EX1 );

  13. Displaying Contents of Table To display all tuples of the table mysql> SELECT * FROM table_name; EX: SELECT * FROM Test1;

  14. To display certain distinct tuples mysql> SELECT [DISTINCT] columnlist FROM tablename(s) [WHERE condition]; EX: SELECT * FROM Test1 WHERE Test_Id= 1;

  15. Renaming the Table mysql> RENAME TABLE tablename TO new-tablename; EX: RENAME TABLE Test1 TO Test_1;

  16. Delete Table Even though users delete the table, the schema would be there. mysql> DELETE FROM tablename [WHERE condition]; EX: DELETE FROM Test_1 WHERE Test_Id = 1;

  17. Delete To completely delete all the entries to the table; however, it will keep the schema. Mysql> DELETE FROM table_name; EX: DELETE FROM Test_1;

  18. To show the schema of Table mysql> SHOW COLUMNS FROM table_name; Or mysql> DESC table_name; EX: SHOW COLUMNS FROM Test_1; Or DESC Test_1;

  19. DROP To completely delete the table from database, users can use DROP command. Mysql> DROP TABLE table_name; EX: DROP TABLE Test_1;

  20. Show Tables in Database To show all the existing tables in a database mysql> SHOW TABLES;

  21. Log Out of MySQL and SSH Type two time exit , it will log out of mysql and ssh. You can close SSH choosing exit button in file appears at the top-left most of SSH screen. Every command in mysql should be end with a semicolon (;) . MySQl is not case-sensitive for its command keywords; however, it is case sensitive for its variables. For ex: variables like Table name, Column Name etc are case sensitive. Whereas, keywords like SELECT, create etc are not case sensitive.

Related


More Related Content