- 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 6702 Articles for Database
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)
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
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)
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
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
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
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
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
63 Views
MySQL database provides us the following programs as administrative tools to manage MySQL server −mysqldIt is also known as MySQL server daemon. It is the main program that does most of the work in a MySQL installation. We need to use ‘mysqld’ to start our MySQL server. It is having many options that can be specified at the time of startup.mysqladminProcessing Re-write Suggestions Done (Unique Article)Basically ‘mysqladmin’ could be a client for playacting administrative operations. we are able to use it to see the server’s configuration and current status, to create and drop databases, and plenty of a lot of.For ... Read More
385 Views
With the help of ‘mysqladmin’ program we would be able to shutdown our MySQL server. It can be used as follows on command line −C:\mysql\bin>mysqladmin -u root shutdownWe will see nothing after entering the above command because it will not print any message in command window. We should have to trust that MySQL server has been shutdown properly.