How to Change a users password from unix shell

# [mysql dir]/bin/mysqladmin -u username -h hostname.blah.org -p password ‘new-password’ To change a user’s password in MySQL from the MySQL prompt while logged in as the root user, you can use the following steps: To change a MySQL user’s password from the Unix shell, you can use the mysqladmin command. Here’s an example: bash mysqladmin … Read more

How to Creating a new user. Login as root. Switch to the MySQL db. Make the user. Update privs

# mysql -u root -p mysql> use mysql; mysql>INSERTINTO user (Host,User,Password) VALUES(‘%’,’username’,PASSWORD(‘password’)); mysql> flush privileges; To create a new user in MySQL, you can follow these steps: Login as root: bash mysql -u root -p You will be prompted to enter the root password. Switch to the MySQL database: sql USE mysql; Create the new … Read more

How to Join tables on common columns

mysql> select lookup.illustrationid, lookup.personid,person.birthday from lookup left join person on lookup.personid=person.personid=statement to join birthday in person table with primary illustration id In MySQL, you can join tables on common columns using the JOIN clause in a SELECT statement. The common columns are specified in the ON clause. There are different types of joins, including INNER … Read more

How to Return total number of rows

mysql> SELECT COUNT(*) FROM tablename; To return the total number of rows in a MySQL table, you can use the COUNT() function in a SQL query. Here’s an example: sql SELECT COUNT(*) AS total_rows FROM your_table_name; Replace your_table_name with the actual name of your table. This query will return a single value named total_rows, representing … Read more

How we will Show selected records sorted in an ascending (asc) or descending (desc)

mysql> SELECT col1,col2 FROM tablename ORDER BY col2 DESC; mysql> SELECT col1,col2 FROM tablename ORDER BY col2 ASC; In MySQL, you can use the ORDER BY clause to sort selected records in either ascending (ASC) or descending (DESC) order. Here’s the basic syntax: sql SELECT column1, column2, … FROM table_name ORDER BY column1 [ASC | … Read more