- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 4378 Articles for MySQL
![mkotla](https://www.tutorialspoint.com/assets/profiles/13540/profile/60_41073-1512640012.jpg)
284 Views
We can also use ALTER USER statement along with IDENTIFIED BY clause to change MySQL user password. Its syntax would be as possible −SyntaxALTER USER user_name@host_name IDENTIFIED BY ‘new_password’Here, New_password would be new password we want to set for MySQL userUser_name is the name of a current user.Host_name is the name of the host of a current user.ExampleSuppose if we want to change the password user@localhost to ‘tutorials’ then it can be done as follows −ALTER USER user@localhost IDENTIFIED BY ‘tutorials’
![Govinda Sai](https://www.tutorialspoint.com/assets/profiles/13542/profile/60_86497-1512650655.jpg)
246 Views
We can use SET PASSWORD statement to change the password. Before using this command, we need to have at least UPDATE privileges. Its syntax would be as follows −SyntaxSET PASSWORD FOR ‘user_name@host_name’=new_password;Here, New_password would be new password we want to set for MySQL userUser_name is the name of the current user.Host_name is the name of the host of the current user.ExampleSuppose if we want to change the password user@localhost to ‘tutorials’ then it can be done as follows −SET PASSWORD FOR ‘user@localhost’= tutorials;
![Samual Sam](https://www.tutorialspoint.com/assets/profiles/13514/profile/60_83486-1512649303.jpg)
183 Views
We need to use nested SUBSTRING_INDEX() function for getting the substring as output which is between two same delimiters in a string. For example, from the string ‘www.tutorialspoint.com’, we want the substring ‘tutorialspoint’, which is in between two same delimiters ‘.’ as output then SUBSTRING_INDEX() function can be used in nested form as follows −mysql> Select SUBSTRING_INDEX(SUBSTRING_INDEX('www.tutorialspoint.com','.',2),'.',-1)AS 'Nested SUBSTRING_INDEX'; +------------------------+ | Nested SUBSTRING_INDEX | +------------------------+ | tutorialspoint | +------------------------+ 1 row in set (0.02 sec)
![Chandu yadav](https://www.tutorialspoint.com/assets/profiles/22330/profile/60_142811-1519038104.jpg)
628 Views
Suppose we have a table named ‘ipaddress’ which contains the IP addresses as its values in column ‘IP’ as follows −mysql> Select * from ipaddress; +-----------------+ | ip | +-----------------+ | 192.128.0.5 | | 255.255.255.255 | | 192.0.255.255 | | 192.0.1.5 | +-----------------+ 4 rows in set (0.10 sec)Now with the help of SUBSTRING_INDEX() function in the following query, we can divide the IP address in four octets −mysql> Select IP, SUBSTRING_INDEX(ip, '.', 1)AS '1st Part', -> SUBSTRING_INDEX(SUBSTRING_INDEX(ip, '.', 2), '.', -1)AS '2nd Part', ... Read More
![Rama Giri](https://www.tutorialspoint.com/assets/profiles/13881/profile/60_68188-1512710896.jpg)
276 Views
MySQL SUBSTRING_INDEX() function can accept the negative value of argument ‘count’ and in this case, it returns the substring from the right of the final delimiter.Examplemysql> Select SUBSTRING_INDEX('www.google.com','.',-2); +------------------------------------------+ | SUBSTRING_INDEX('www.google.com','.',-2) | +------------------------------------------+ | google.com | +------------------------------------------+ 1 row in set (0.00 sec) mysql> Select SUBSTRING_INDEX('www.google.com','.',-1); +------------------------------------------+ | SUBSTRING_INDEX('www.google.com','.',-1) | +------------------------------------------+ | com | +------------------------------------------+ 1 row in set (0.00 sec)
![Vrundesha Joshi](https://www.tutorialspoint.com/assets/profiles/13566/profile/60_88163-1512715024.jpg)
6K+ Views
Actually, we need to perform flush-privileges operation to tell the server to reload the grant tables. This can be done by issuing FLUSH PRIVILEGES statement or by executing a mysqladmin flush-privileges or mysqladmin reload command. FLUSH PRIVILEGES is really needed if we modify the grant tables directly using such as INSERT, UPDATE or DELETE, the changes have no effect on privileges checking until we either restart the server or tell it to reload the tables. But, Privileges assigned through GRANT choice don't want FLUSH PRIVILEGES to take effect - MySQL server cannotice these changes and reload the grant tables instantly. ... Read More
![Giri Raju](https://www.tutorialspoint.com/assets/profiles/13536/profile/60_72105-1512540773.jpg)
2K+ Views
To change MySQL user password with the help of UPDATE statement, we need to update the ‘user’ table of the ‘mysql’ database. Its syntax would be as follows −SyntaxUSE mysql; UPDATE user SET authentication_string = PASSWORD(‘new_password’) WHERE user = user_name AND host = host_name;The first two statements will be common because to change the password for MySQL user we need to use MySQL database and update the user table.New_password would be new password we want to set for MySQL userUser_name is the name of the current user.Host_name is the name of the host of the current user.ExampleSuppose if we want ... Read More
![Rishi Rathor](https://www.tutorialspoint.com/assets/profiles/13563/profile/60_89283-1512714754.jpg)
189 Views
We need to use ‘mysqlshow’ client program along with the name of the database to get the list of tables in a particular database. Its syntax would be as follows −Mysqlshow – u root db_name [pat_matching]Here db_name would be the name of the database from which we want to get the name of tables.Pat_matching is optional. It is used to get the list of the tables of some specific pattern. If we will not provide any pattern then it will show all the tables stored in that database.ExampleThe following command will get all the tables of database ‘query’ −C:\mysql\bin>mysqlshow -u ... Read More
![Ramu Prasad](https://www.tutorialspoint.com/assets/profiles/13539/profile/60_87996-1512650215.jpg)
177 Views
We need to use ‘mysqlcheck’ client program along with –analyze option to analyze the tables of a particular database. Its syntax would be as follows −Mysqlcheck – u root –analyze db_nameExampleThe following command will analyze the tables of database ‘query’ −C:\mysql\bin>mysqlcheck -u root --analyze query query.cars OK query.copy_cars OK query.countries Table is already up to date query.customers ... Read More
![Nancy Den](https://www.tutorialspoint.com/assets/profiles/13557/profile/60_88439-1512714529.jpg)
867 Views
With the help of ‘mysqladmin’ along with ‘status’ option program we would be able to check the status of MySQL server. It can be used as follows on command line −C:\mysql\bin>mysqladmin -u root status Uptime: 3865 Threads: 1 Questions: 50 Slow queries: 0 Opens: 113 Flush tables: 1 Open tables: 102 Queries per second avg: 0.012