MySQL is a component of the LAMP web application software stack (and others), which is an acronym for Linux, Apache, MySQL, Perl/ PHP/ Python. MySQL has stand-alone clients that allow users to interact directly with a MySQL database using SQL, but more often, MySQL is used with other programs to implement applications that need relational database capability. In 2010, when Oracle acquired Sun, Widenius forked the open-source MySQL project to create MariaDB. MySQL was owned and sponsored by the Swedish company MySQL AB, which was bought by Sun Microsystems (now Oracle Corporation). MySQL is free and open-source software under the terms of the GNU General Public License, and is also available under a variety of proprietary licenses. In addition to relational databases and SQL, an RDBMS like MySQL works with an operating system to implement a relational database in a computer's storage system, manages users, allows for network access and facilitates testing database integrity and creation of backups. SQL is a language that programmers use to create, modify and extract data from the relational database, as well as control user access to the database. A relational database organizes data into one or more data tables in which data may be related to each other these relations help structure the data. Its name is a combination of "My", the name of co-founder Michael Widenius's daughter My, and "SQL", the acronym for Structured Query Language. MySQL ( / ˌ m aɪ ˌ ɛ s ˌ k juː ˈ ɛ l/) is an open-source relational database management system (RDBMS). Use select current_user() to show the current user.Linux, Solaris, macOS, Windows, FreeBSD.List all users by querying from the user table of the mysql database.| event_scheduler | localhost | NULL | Daemon |Ģ rows in set ( 0.00 sec) Code language: SQL (Structured Query Language) ( sql ) Summary | root | localhost:62277 | mysql | Query | To list all users that are currently logged in the MySQL database server, you execute the following statement: SELECT user,Ĭommand FROM information_schema. To get the information on the current user, you use the user() function as shown in the following statement: SELECT user() ġ row in set ( 0.00 sec) Code language: SQL (Structured Query Language) ( sql )Īlternatively, you use the current_user() function: SELECT current_user() ġ row in set ( 0.00 sec) Code language: SQL (Structured Query Language) ( sql ) Show all currently logged-in users +-+-+-+-+Ĥ rows in set (0.00 sec) Code language: JavaScript ( javascript ) Show the current user | user | host | account_locked | password_expired | The following example lists all users and other information such as host, account locking, and password expiration status: SELECT user,įROM user Code language: SQL (Structured Query Language) ( sql ) To get more information on the user table, you can preview its columns using the following command: DESC user Code language: SQL (Structured Query Language) ( sql ) It returns the user list like this: +-+Ĥ rows in set (0.00 sec) Code language: JavaScript ( javascript ) Third, retrieve all users in the current database server by querying the user column of the user table: select user from user Code language: JavaScript ( javascript ) Second, change the current database to the mysql database: use mysql Code language: PHP ( php ) Listing all users by querying the user tableįirst, open Command Prompt on Windows or Terminal on Unix-like systems and log in to the MySQL server: mysql -u root -p Summary: in this tutorial, you will learn various techniques to show users in MySQL server.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |