
<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title> &#187; Database Administration</title>
	<atom:link href="https://www.nikeshshk.com.np/category/database-administration/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.nikeshshk.com.np</link>
	<description></description>
	<lastBuildDate>Tue, 04 Nov 2025 10:25:45 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=4.2.4</generator>
	<item>
		<title>How To Create a New User and Grant Permissions in MySQL</title>
		<link>https://www.nikeshshk.com.np/news/how-to-create-a-new-user-and-grant-permissions-in-mysql/</link>
		<comments>https://www.nikeshshk.com.np/news/how-to-create-a-new-user-and-grant-permissions-in-mysql/#comments</comments>
		<pubDate>Sat, 13 Jun 2015 04:43:01 +0000</pubDate>
		<dc:creator><![CDATA[admin]]></dc:creator>
				<category><![CDATA[Database Administration]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[News]]></category>
		<category><![CDATA[create mysql user with permission]]></category>
		<category><![CDATA[grant permission mysql]]></category>
		<category><![CDATA[mysql user]]></category>

		<guid isPermaLink="false">http://www.nikeshshk.com.np/?p=824</guid>
		<description><![CDATA[In the cases where more restrictions may be required, there are ways to create users with custom permissions. Let’s start by making a new user within the MySQL shell: CREATE USER 'nikesh'@'localhost' IDENTIFIED BY 'password'; Sadly, at this point newuser has no permissions to do anything with the databases. In fact, if newuser even tries to login (with the password, password), they will not be able to reach the MySQL shell. Therefore, the first thing to do is to create new database and provide the user with access to that database. create database nikeshdb; GRANT ALL PRIVILEGES ON nikeshdb.* TO 'nikeshshk'@'localhost'; The asterisks in this command refer to table that they can access—this specific command allows to the user to read, edit, execute and perform all tasks across all the databases and tables. Once you have finalized the permissions that you want to set up for your new users, always be sure to reload all the privileges. FLUSH PRIVILEGES; Your&#160;<a href="https://www.nikeshshk.com.np/news/how-to-create-a-new-user-and-grant-permissions-in-mysql/" class="read-more">Continue Reading</a>]]></description>
				<content:encoded><![CDATA[<p>In the cases where more restrictions may be required, there are ways to create users with custom permissions.<br />
Let’s start by making a new user within the MySQL shell:</p>
<p><code>CREATE USER 'nikesh'@'localhost' IDENTIFIED BY 'password';</code></p>
<p>Sadly, at this point newuser has no permissions to do anything with the databases. In fact, if newuser even tries to login (with the password, password), they will not be able to reach the MySQL shell.</p>
<p>Therefore, the first thing to do is to create new database and  provide the user with access to that database.</p>
<p><code>create database nikeshdb;</p>
<p>GRANT ALL PRIVILEGES ON nikeshdb.* TO 'nikeshshk'@'localhost';</code></p>
<p>The asterisks in this command refer to table that they can access—this specific command allows to the user to read, edit, execute and perform all tasks across all the databases and tables.<br />
Once you have finalized the permissions that you want to set up for your new users, always be sure to reload all the privileges.</p>
<p><code>FLUSH PRIVILEGES;</code></p>
<p>Your changes will now be in effect.</p>
<p>How To Grant Different User Permissions<br />
Here is a short list of other common possible permissions that users can enjoy.</p>
<p>ALL PRIVILEGES- as we saw previously, this would allow a MySQL user all access to a designated database (or if no database is selected, across the system)<br />
<code>CREATE- allows them to create new tables or databases<br />
DROP- allows them to them to delete tables or databases<br />
DELETE- allows them to delete rows from tables<br />
INSERT- allows them to insert rows into tables<br />
SELECT- allows them to use the Select command to read through databases<br />
UPDATE- allow them to update table rows<br />
GRANT OPTION- allows them to grant or remove other users' privileges</code><br />
To provide a specific user with a permission, you can use this framework:</p>
<p> <code>GRANT [type of permission] ON [database name].[table name] TO ‘[username]’@'localhost’;</code><br />
If you want to give them access to any database or to any table, make sure to put an asterisk (*) in the place of the database name or table name.</p>
<p>Each time you update or change a permission be sure to use the Flush Privileges command.</p>
<p>If you need to revoke a permission, the structure is almost identical to granting it:</p>
<p><code> REVOKE [type of permission] ON [database name].[table name] FROM ‘[username]’@‘localhost’;</code><br />
Just as you can delete databases with DROP, you can use DROP to delete a user altogether:</p>
<p><code> DROP USER ‘demo’@‘localhost’;</code><br />
To test out your new user, log out by typing</p>
<p><code> quit </code><br />
and log back in with this command in terminal:</p>
<p><code>mysql -u [username]-p</code></p>
]]></content:encoded>
			<wfw:commentRss>https://www.nikeshshk.com.np/news/how-to-create-a-new-user-and-grant-permissions-in-mysql/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Remove Duplicate Rows from a Table in SQL Server</title>
		<link>https://www.nikeshshk.com.np/news/remove-duplicate-rows-from-a-table-in-sql-server/</link>
		<comments>https://www.nikeshshk.com.np/news/remove-duplicate-rows-from-a-table-in-sql-server/#comments</comments>
		<pubDate>Mon, 21 Apr 2014 08:01:54 +0000</pubDate>
		<dc:creator><![CDATA[Nikesh Shakya]]></dc:creator>
				<category><![CDATA[Database Administration]]></category>
		<category><![CDATA[News]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[remove duplicates]]></category>
		<category><![CDATA[sql]]></category>
		<category><![CDATA[sqlserver]]></category>

		<guid isPermaLink="false">http://www.nikeshshk.com.np/?p=670</guid>
		<description><![CDATA[Firstly, we will create a table, where we will insert some duplicate rows to understand the topic properly. Create a table called ATTENDANCE by using the following code: CREATE TABLE [dbo].[ATTENDANCE]( [EMPLOYEE_ID] [varchar](50) NOT NULL, [ATTENDANCE_DATE] [date] NOT NULL ) ON [PRIMARY] Now insert some data into this table. INSERT INTO dbo.ATTENDANCE (EMPLOYEE_ID,ATTENDANCE_DATE)VALUES ('A001',CONVERT(DATETIME,'01-01-11',5)) INSERT INTO dbo.ATTENDANCE (EMPLOYEE_ID,ATTENDANCE_DATE)VALUES ('A001',CONVERT(DATETIME,'01-01-11',5)) INSERT INTO dbo.ATTENDANCE (EMPLOYEE_ID,ATTENDANCE_DATE)VALUES ('A002',CONVERT(DATETIME,'01-01-11',5)) INSERT INTO dbo.ATTENDANCE (EMPLOYEE_ID,ATTENDANCE_DATE)VALUES ('A002',CONVERT(DATETIME,'01-01-11',5)) INSERT INTO dbo.ATTENDANCE (EMPLOYEE_ID,ATTENDANCE_DATE)VALUES ('A002',CONVERT(DATETIME,'01-01-11',5)) INSERT INTO dbo.ATTENDANCE (EMPLOYEE_ID,ATTENDANCE_DATE)VALUES ('A003',CONVERT(DATETIME,'01-01-11',5)) After inserting the data, check the data of the below table. If we grouped the employee_id and attendance_date, then A001 and A002 become duplicates. EMPLOYEE_ID ATTENDANCE_DATE A001 2011-01-01 A001 2011-01-01 A002 2011-01-01 A002 2011-01-01 A002 2011-01-01 A003 2011-01-01 So how can we delete those duplicate data? Solution First, insert an identity column in that table by using the following code: ALTER TABLE dbo.ATTENDANCE ADD AUTOID INT IDENTITY(1,1) Now the table data will be like the following table: EMPLOYEE_ID ATTENDANCE_DATE AUTOID A001&#160;<a href="https://www.nikeshshk.com.np/news/remove-duplicate-rows-from-a-table-in-sql-server/" class="read-more">Continue Reading</a>]]></description>
				<content:encoded><![CDATA[<p>Firstly, we will create a table, where we will insert some duplicate rows to understand the topic properly. Create a table called ATTENDANCE by using the following code:</p>
<p><code>CREATE TABLE [dbo].[ATTENDANCE](<br />
[EMPLOYEE_ID] [varchar](50) NOT NULL,<br />
[ATTENDANCE_DATE] [date] NOT NULL<br />
) ON [PRIMARY] </code></p>
<p>Now insert some data into this table.</p>
<p><code>INSERT INTO dbo.ATTENDANCE (EMPLOYEE_ID,ATTENDANCE_DATE)VALUES<br />
('A001',CONVERT(DATETIME,'01-01-11',5))<br />
INSERT INTO dbo.ATTENDANCE (EMPLOYEE_ID,ATTENDANCE_DATE)VALUES<br />
('A001',CONVERT(DATETIME,'01-01-11',5))<br />
INSERT INTO dbo.ATTENDANCE (EMPLOYEE_ID,ATTENDANCE_DATE)VALUES<br />
('A002',CONVERT(DATETIME,'01-01-11',5))<br />
INSERT INTO dbo.ATTENDANCE (EMPLOYEE_ID,ATTENDANCE_DATE)VALUES<br />
('A002',CONVERT(DATETIME,'01-01-11',5))<br />
INSERT INTO dbo.ATTENDANCE (EMPLOYEE_ID,ATTENDANCE_DATE)VALUES<br />
('A002',CONVERT(DATETIME,'01-01-11',5))<br />
INSERT INTO dbo.ATTENDANCE (EMPLOYEE_ID,ATTENDANCE_DATE)VALUES<br />
('A003',CONVERT(DATETIME,'01-01-11',5)) </code></p>
<p>After inserting the data, check the data of the below table. If we grouped the employee_id and attendance_date, then A001 and A002 become duplicates.<br />
EMPLOYEE_ID ATTENDANCE_DATE<br />
A001 2011-01-01<br />
A001 2011-01-01<br />
A002 2011-01-01<br />
A002 2011-01-01<br />
A002 2011-01-01<br />
A003 2011-01-01</p>
<p>So how can we delete those duplicate data?<br />
Solution</p>
<p>First, insert an identity column in that table by using the following code:</p>
<p><code>ALTER TABLE dbo.ATTENDANCE ADD AUTOID INT IDENTITY(1,1) </code></p>
<p>Now the table data will be like the following table:<br />
EMPLOYEE_ID ATTENDANCE_DATE AUTOID<br />
A001 2011-01-01 1<br />
A001 2011-01-01 2<br />
A002 2011-01-01 3<br />
A002 2011-01-01 4<br />
A002 2011-01-01 5<br />
A003 2011-01-01 6</p>
<p>Check the AUTOID column. Now we will start playing the game with this column.</p>
<p>Now use the following code to find out the duplicate rows that exist in the table.</p>
<p><code>SELECT * FROM dbo.ATTENDANCE WHERE AUTOID NOT IN (SELECT MIN(AUTOID) FROM dbo.ATTENDANCE GROUP BY EMPLOYEE_ID,ATTENDANCE_DATE)</code></p>
<p>The above code will give us the following result:<br />
EMPLOYEE_ID ATTENDANCE_DATE AUTOID<br />
A001 2011-01-01 2<br />
A002 2011-01-01 4<br />
A002 2011-01-01 5</p>
<p>Ultimately, these are the duplicate rows which we want to delete to resolve the issue. Use the following code to resolve it.</p>
<p><code>DELETE FROM dbo.ATTENDANCE WHERE AUTOID NOT IN (SELECT MIN(AUTOID) FROM dbo.ATTENDANCE GROUP BY EMPLOYEE_ID,ATTENDANCE_DATE) </code></p>
<p>Now check the data. No duplicate rows exist in the table.</p>
<p>Is it too complicated? I dont think so <img src="https://www.nikeshshk.com.np/wp-includes/images/smilies/simple-smile.png" alt=":)" class="wp-smiley" style="height: 1em; max-height: 1em;" /></p>
]]></content:encoded>
			<wfw:commentRss>https://www.nikeshshk.com.np/news/remove-duplicate-rows-from-a-table-in-sql-server/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Unknown table engine &#8216;InnoDB&#8217;</title>
		<link>https://www.nikeshshk.com.np/news/unknown-table-engine-innodb/</link>
		<comments>https://www.nikeshshk.com.np/news/unknown-table-engine-innodb/#comments</comments>
		<pubDate>Thu, 19 Dec 2013 15:27:59 +0000</pubDate>
		<dc:creator><![CDATA[admin]]></dc:creator>
				<category><![CDATA[Database Administration]]></category>
		<category><![CDATA[News]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[mysql]]></category>

		<guid isPermaLink="false">http://www.nikeshshk.com.np/?p=607</guid>
		<description><![CDATA[If You are facing problem with Unknown table engine &#8216;InnoDB&#8217; on to your mysql Database. You can do following to get rid of this problem. First look at the ib_logfile0 and ib_logfile1 in /var/lib/mysql. If they have been set to size different from the default, that probably will prevent mysqld&#8217;s startup. The default for innodb_lkog_file_size is 5M. Add this in my.cnf [mysqld] innodb_log_file_size = 12M And then Proceed by doing following /etc/init.d/mysql stop mv /var/lib/mysql/ib_logfile0 /var/lib/mysql/ib_logfile0.bak # these are your mv /var/lib/mysql/ib_logfile1 /var/lib/mysql/ib_logfile1.bak # log files /etc/init.d/mysql start &#160;]]></description>
				<content:encoded><![CDATA[<p>If You are facing problem with Unknown table engine &#8216;InnoDB&#8217; on to your mysql Database. You can do following to get rid of this problem.</p>
<p>First look at the <code>ib_logfile0</code> and <code>ib_logfile1</code> in <code>/var/lib/mysql</code>.</p>
<p>If they have been set to size different from the default, that probably will prevent mysqld&#8217;s startup. The default for innodb_lkog_file_size is 5M.</p>
<p>Add this in <code>my.cnf</code></p>
<pre><code>[mysqld]
innodb_log_file_size = 12M</code></pre>
<p>And then Proceed by doing following</p>
<pre><code>/etc/init.d/mysql stop

mv /var/lib/mysql/ib_logfile0 /var/lib/mysql/ib_logfile0.bak # these are your
mv /var/lib/mysql/ib_logfile1 /var/lib/mysql/ib_logfile1.bak # log files

/etc/init.d/mysql start</code></pre>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>https://www.nikeshshk.com.np/news/unknown-table-engine-innodb/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Change MySQL root Password</title>
		<link>https://www.nikeshshk.com.np/news/change-mysql-root-password/</link>
		<comments>https://www.nikeshshk.com.np/news/change-mysql-root-password/#comments</comments>
		<pubDate>Sun, 08 Dec 2013 16:13:52 +0000</pubDate>
		<dc:creator><![CDATA[admin]]></dc:creator>
				<category><![CDATA[Database Administration]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[News]]></category>

		<guid isPermaLink="false">http://www.nikeshshk.com.np/?p=539</guid>
		<description><![CDATA[Change MySQL root Password Method #1: Use mysqladmin command to change root password If you have never set a root password for MySQL server, the server does not require a password at all for connecting as root. To setup root password for first time, use mysqladmin command at shell prompt as follows: $ mysqladmin -u root password NEWPASSWORD However, if you want to change (or update) a root password, then you need to use the following command: $ mysqladmin -u root -p'oldpassword' password newpass For example, If the old password is abc, you can set the new password to 123456, enter: $ mysqladmin -u root -p'abc' password '123456' Method #2: Changing MySQL root user password using mysql command This is an another method. MySQL stores username and passwords in user table inside MySQL database. You can directly update or change the password using the following method for user called nixcraft: Login to mysql server, type the following command at shell&#160;<a href="https://www.nikeshshk.com.np/news/change-mysql-root-password/" class="read-more">Continue Reading</a>]]></description>
				<content:encoded><![CDATA[<h2>Change MySQL root Password</h2>
<h2>Method #1: Use mysqladmin command to change root password</h2>
<p>If you have never set a root password for MySQL server, the server does not require a password at all for connecting as root. To setup root password for first time, use mysqladmin command at shell prompt as follows:<br />
<code>$ mysqladmin -u root password NEWPASSWORD</code><br />
However, if you want to change (or update) a root password, then you need to use the following command:</p>
<p><code>$ mysqladmin -u root -p'oldpassword' password newpass</code></p>
<p>For example, If the old password is abc, you can set the new password to 123456, enter:</p>
<pre>$ mysqladmin -u root -p'abc' password '123456'</pre>
<h2>Method #2: Changing MySQL root user password using mysql command</h2>
<p>This is an another method. MySQL stores username and passwords in user table inside MySQL database. You can directly update or change the password using the following method for user called nixcraft:</p>
<h3>Login to mysql server, type the following command at shell prompt:<br />
<code>$ mysql -u root -p</code></h3>
<h3>Use mysql database (type command at mysql&gt; prompt):</h3>
<pre>mysql&gt; use mysql;</pre>
<h3>Change password for user nixcraft, enter:</h3>
<pre>mysql&gt; update user set password=PASSWORD("NEWPASSWORD") where User='nikesh';</pre>
<h3>Finally, reload the privileges:</h3>
<pre>mysql&gt; flush privileges;
mysql&gt; quit</pre>
]]></content:encoded>
			<wfw:commentRss>https://www.nikeshshk.com.np/news/change-mysql-root-password/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
