Showing posts with label Mysql. Show all posts
Showing posts with label Mysql. Show all posts

Monday, September 25, 2017

How to delete Mysql user?

 
COMMAND TO DROP USER:
 
Login into SQl With User Root and Run:
 

DROP USER 'jeffrey'@'localhost';

DROP USER vishal;

 

Tuesday, July 21, 2015

Restore MySQL database from a backup file

Backing up your MySQL Databases

The following command will dump all databases to an sql file. Replace pass with your root database password and filename with the name of the file you wish to create such as backup.sql
# mysqldump -u<user> -p<pass> -B --all-databases > <filename>
# mysqldump -uroot -pSuperPass -B --all-databases > all.sql
A single database can be backed up also.
# mysqldump -u<user> -p<pass> <database> > <filename>
# mysqldump -uWiki -pBlue wikidb > wikidb.sql

Restore MySQL database from a backup file

There are many reasons you would want to restore a database from a backup file… But you should also test this on a test server just to make sure that your database backups are working correctly. Here’s the syntax:
mysql -h hostname -u username -pthepassword databasename < dumpfile.sql
Here’s an example:
mysql -h localhost -u root -ptgX!2121 < thedumpfile.sql

Sunday, July 19, 2015

Cpanel Enable the slow query log

You would add the following to /etc/my.cnf file to enable the slow query log.
log-slow-queries=/var/lib/mysql/slow.log
After that, then do the following commands to create the file with the right ownership and file permissions:
touch /var/lib/mysql/slow.log
chmod 660 /var/lib/mysql/slow.log
chown mysql:mysql /var/lib/mysql/slow.log


Thursday, June 4, 2015

Can't connect to MySQL server on 'localhost' (10055)"


Cause of MySQL Error 10055?

This is more of an Operating System Error than a MySQL error.  Each time your website runs a query you open a connection to the Database, run the query, then close the connection.  Each time this happens your Server allocates a dynamic port for use by MySQL and your Website.  For Websites like mine which may run 2000+ Queries per second, this means that 2000+ dynamic ports must be set aside for these connections.  Sometimes your server gets under load and the operating system can't recycle these ports fast enough, leading you to run out of ports and then your server throws a 10055 Error.

By default Windows Server 2008 R2 has 16838 Ports designated for Dynamic use.  The default ranges are 49152 - 65535.  However this can be extended to a wider range of ports.

Fix MySQL Error 10055:

To fix the problem you need to increase the number of dynamic ports.
Running the following Commands will give give you 50000 ports for dynamic use.

On Windows Server 2008 R2
Open command Prompt

Type the following:
netsh int ipv4 set dynamicport tcp start=10000 num=50000
Press Enter

Type the following
netsh int ipv4 set dynamicport udp start=10000 num=50000
Press Enter