MysqlHow to select lamp mysqlHow to use mysql of /opt/lampp/bin/mysqlHow to use the mysql command in "/opt/lampp/bin/mysql"? How to use the mysql db present in lampp server? When you type mysql in linux command prompt, normally it takes you to the mysql prompt. But when you use wish to use the DB present in /op or different directory you can use .. Query to get 5 rows from each categorySelect first least max row per group in sqlConsider that you have a table as below and you want to select some five rows from each column. In such situation you can use join statement. ID Dept Names --------------------- 1 ECE Mark 2 ECE .. Delete a rowHow to delete a particular rowIn mysql if you want to delet a particular row or column you can follow the below steps. Before deleting the row from the table make sure that what you are doing. Once if you delete the row then it cant be recovered. Syntax: delete from table_name where column_name='value'; Example: mysql> .. Error host name is blocked too many connectionHost host_name is blockedError: Host 'host_name' is blocked because of many connection errors; unblock with 'mysqladmin flush-hosts' In mysql the number of connection is determined by mysql system variable 'max_connect_errors' Mysql will assume that some thing is wrong with the host and it will block the host. To unblock the host you have to .. Mysqldump backup and restore dataExport and Import mysql databaseTo backup a database named 'tutorials_DB' with the username 'root' and with no password to a file tut_backup.sql, you should accomplish this command: mysqldump -u root -p tutorials_DB > tut_backup.sql If you are moving your data to a new server, or you have removed the old database completely you can restore it .. Restore mysql database from command prompt in lamppImport mysql database in lamppConsider that you have installed your lampp under /opt director So you lampp folder seems to be like /opt/lampp/, by default the path of the mysql is /opt/lampp/var/mysql/ when you type the mysql connector will search for the socket, to specify the socket use the bellow command mysql -u root --socket=/opt/lampp/var/mysql/mysql.sock To import or .. Mysql command prompt from lamppLampp connect mysql socketConsider that you have installed your lampp under /opt director So you lampp folder seems to be like /opt/lampp/, by default the path of the mysql is /opt/lampp/var/mysql/ when you type the mysql connector will search for the socket, to specify the socket use the bellow command mysql -u root --socket=/opt/lampp/var/mysql/mysql.sock Now, If you .. Trigger super user permissionSet user as a super userWhen you want to set super user permission for particular user in mysql then you can use the below command to set such permission. GRANT USAGE ON *.* TO user@host IDENTIFIED BY 'password'; When a user wants to use trigger function in mysql, then you might have a make an user .. Where can i find mysql general information and error messageMySQL General Information and ErrorsMySQL General Information and Errors: Location : /var/lib/mysql/$(hostname).err Description : This path could vary, but is generally located in /var/lib/mysql. Could also be located at /var/log/mysqld.log .. How to use soundex function in mysqlReturns a soundex stringSOUNDEX(str) Returns a soundex string from str. Two strings that sound almost the same should have identical soundex strings. A standard soundex string is 4 characters long, but the SOUNDEX() function returns an arbitrarily long string. You can use SUBSTRING() on the result to get a standard soundex string. All .. Aggregates of specified sizeMysql aggregate specified sizeFind the values of a table column c1 for which there are a specified number of listed values in another column c2. To get an overview of the values of c2 for each value of c1: SELECT c1, GROUP_CONCAT(c2 ORDER BY c2) AS 'C2 values' FROM table GROUP BY c1; To retrieve a .. Aggregates across multiple join mysql joinsMysql Aggregates tableGiven a parent table and two child tables, a query which sums values in both child tables, grouping on a parent table column, returns sums that are exactly twice as large as they should be. In this example from the MySQL General Discussion list. DROP TABLE IF EXISTS packageItem,packageCredit,packageItemTax; CREATE TABLE .. Basics of aggregationMySQL introduced the sqlThis is the simplest grouping query pattern. For column foo, display the first (smallest), last (largest) or average value of column bar. SELECT foo, MIN(bar) AS bar FROM tbl GROUP BY foo Return the highest bar value for each foo, ordering top to bottom by that value: SELECT foo, MAX(bar) AS Count .. Mysql command to convert a string to lowercaseConvert a string to lowercaseMySQL command to convert a string to lowercase In MYSQL we have a command LOWER() which help us to convert a string to lowercase. For Example: We have MYSQL database of keywords that are presently mixed-case. If we want to convert them all to lowercase we can use the command LOWER(). 1. Set .. Mysql coalesce select not null valueSelect non value mysql queryMysql coalesce selects the first not-null value of its arguments. Syntax: coalesce(value,..) It returns the first non NULL value in the list. If there are no non-NULL values then it returns NULL. .. |