Mysql

Mysql datatype varchar vs mediumtext

Which data type is better to use

Answering this question is difficult, some one thinks its silly question and even this might not be considered as a question by few developers. But actually for developers in beginning stage, it might be difficult to make decision which data type has to be selected. To be honest even I  ..

How to change date format in mysql

Convert mysql date format YYYY-MM-DD to DD, MM, YYYY

You can Convert mysql date format YYYY-MM-DD to DD, MM, YYYY using the DATE_FORMAT() in mysql SELECT DATE_FORMAT(table.fieldname,'%e %m, %y') FROM tablename You can change the date format as you wish.  ..

How import xMB file in phpmyadmin

How to import huge Database in Mysql

Importing the SQL file: If you have a Unix/Linux server and have SSH access to it then you can use the 'mysql' command line program to import the file like so: mysql -u myuser -p mydatabase < myfile.sql This will prompt you for the password for 'myuser' and then import the SQL  ..

Set alias name for a field

Temporary Files name

How to set alias for a field temporarily? Mysql AS Clause a simple example alias is a short name used in mysql to shorten the query. it is used with "AS" in mysql query. For eg: SELECT SUM(*) AS cnt from test you can also use it in multiple table select query.   ..

How to reset mysql root password

Change mysql root password

Changing mysql root password: 1. Stop MySQL: # /etc/init.d/mysql stop 2. Start the MySQL server without privilege tables: # mysqld --skip-grant-tables 3. Start the mysql client: # mysql 4. Find name of admin user (probably 'root'), update password: # select user,host,password from mysql.user; -- reset password for admin user 'root' (or whatever the name is)   ..

Syntax to find difference between two dates

How to find diff between two given dates

To find the different between two given dates in months: period_diff is a mysql function which is used to find the difference between two given dates. This will help to find the difference between any given dates. Use PeriodDiff mysql function http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html#function_period-diff Example: select period_diff(date_format(date1row, '%Y%m'), date_format(date2row, '%Y%m')) as months from your_table;   ..

How to select lamp mysql

How to use mysql of /opt/lampp/bin/mysql

How 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 category

Select first least max row per group in sql

Consider 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 row

How to delete a particular row

In 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 connection

Host host_name is blocked

Error: 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 data

Export and Import mysql database

To 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 lampp

Import mysql database in lampp

Consider 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 lampp

Lampp connect mysql socket

Consider 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 permission

Set user as a super user

When 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 message

MySQL General Information and Errors

MySQL 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   ..

Previous 1 2 3 Next

Tech Bluff