Share on Google+Share on Google+

Victor Ajakpo
Changing root Password
1 Answer(s)      5 years and 2 months ago
Posted in : SQL

how do i change the root password in mysql

Ads

View Answers

February 10, 2012 at 4:03 PM


import java.sql.*;
class ChangeRootPassword
{
    public static void main(String[] args) 
    {
        try{
            Class.forName("com.mysql.jdbc.Driver");
            Connection conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/test", "root", "root");
            String sql = "SET PASSWORD FOR 'root'@'localhost' = PASSWORD('admin')";
            Statement stmt = conn.createStatement();
            stmt.executeQuery(sql);
            stmt.close();
            conn.close();
            }
        catch(Exception ex){
            ex.printStackTrace();
            }
    }
}









Related Tutorials/Questions & Answers:
Changing root Password
Changing root Password  how do i change the root password in mysql
Change root password of MYSQL using Java
of Code: Changing the root password of a MySQL database is trivial if you know...Change root password of MYSQL using Java In this tutorial, you will learn how to change the root password of MYSQL database using java code. For every
Advertisements
MySQL Creating account and changing password
MySQL Creating account and changing password   ...; [email protected]:~# /opt/sfw/bin/mysql -p Enter password: ROOT-PASSWORD... or  you want to change the password then make new user .This lesson you learn how
Password
Password  make a program which ask ask the username and password * in this format. in C language
Cube Root
Cube Root  Hi, Can one one please tell me how to find the cube root of any number without using any inbuilt function?? Regards: Akash
Square Root
Square Root  Hi, can any one please tell me the code to findout the square root of a given number with using built in function??? Thanks a lot in advance!! Regards: Akash
changing of data...
servlet.database is not changing in 10 second  hi.... i have created a servlet page using a response.setheader(); method.in the parameter i have... this servlet.database is not changing in 10 second...what should i do..?? reply fast
changing of data...
data changing in 10 second  hi.... i have created a servlet page using a response.setheader(); method.in the parameter i have given 10 second.but... is not changing in 10 second...what should i do..?? reply fast
changing of data...
changing of data...  hi.... i have created a servlet page using a response.setheader(); method.in the parameter i have given 10 second.but once... is not changing in 10 second...what should i do..?? reply fast
XML root element
XML root element  Hi..... please tell me about that Can a root element type be explicitly declared in the DTD? Thanks
Add a root element
Add a root element  i have one doubt, This is my current xml doc. ? But I want add a tag at first and last line of a xml by using JDOM(SAX Builder). Like
changing uiview background color
changing uiview background color  changing UIView background color in ios   self.view.backgroundColor = [UIColor colorWithRed:244.0f/255.0f green:230.0f/255.0f blue:183.0f/255.0f alpha:1.0f
Password validation
password and confirm password are same or not Validation  Hi. I have a change password form. In that i have to check the values given in the new password and confirm password are same or not. Please help.   Here
Password validation
Password validation  Hi. I have a change password form. In that i have to check the values given in the new password and confirm password are same or not. Please help.   Here is a code that accepts the current password
Password validation
Password validation  Hi. I have a change password form. In that i have to check the values given in the new password and confirm password are same or not. Please help.   Here is a code that accepts the current password
Password validation
Password validation  Hi. I have a change password form. In that i have to check the values given in the new password and confirm password are same or not. Please help.   Here is a code that accepts the current password
Password validation
Password validation  Hi. I have a change password form. In that i have to check the values given in the new password and confirm password are same or not. Please help.   Here is a code that accepts the current password
Changing pictures - Java Beginners
Changing pictures  I found some html code that allows pictures to be changed on a web page. I copied the code and saved it as an html file. when I... Explorer that have pictures changing on them and they do not get blocked? 
Changing MySQL Port Number
Changing MySQL Port Number  How to change the MySQL port no in windows.   Hi, Open the my.ini file present in the MySQL server installation directory. Change the port number to desired port number. By default port
forgot password?
forgot password?  forgot password
Changing 2D graph using slider.
Changing 2D graph using slider.  Code for changing a 2d graph with help of slider
changing the file content
changing the file content  I have requirement like this, a file contain maximum 1000 lines. I want to cahnage the 501 line content. I know this logic , reading the file content and changeing the 501 line content and crating one
changing selection color of <button>
changing selection color of   dear all, i have loaded image in border less button tag when button is selected with tab key i get brown color rectangle around image. how do i change color of that rectangle from brown to white
Username password
with the validation, so that if the username and password match it will continue... that checks whether the username and password is valid or not. If the user...("Password:"); text2 = new JPasswordField(15); SUBMIT=new JButton("SUBMIT
Tree Root Hide in Java
Tree Root Hide in Java       In this section, you will learn to hide the root node of  a JTree.  Description of the Program: The following program helps to hide the root
Java Square Root And Cube Root Example
Java Square Root And Cube Root Example In this section we will discuss about how to find the square root and cube root of a number. This example explains you about finding the square root and cube root of a number. This tutorial
password check
password check  how to check sighup passowrd and login password
compute nth root - Java Beginners
compute nth root  write a program that computes the nth root of a number. given a real number X greater than 1 and less than -1 and given an integer Y, compute the nth root Z such that Z*Z*Z*Z*Z*Z*Z...(Y times)..Z*Z=X, or Z^y=X
change password
change password  how to change password in the login form.... by giving options to user like this old password, new password.. pls help
retype password
retype password  coding for retype password
Reset Password
Reset Password  coding for reset password
Tutorials   
Java Spring Hibernate Struts Training How to Fetch Data using dropdown option How to get day from date in SQL? Example of sorting results in MySQL Distinct and Limit example in MySQL How to download install and use MySQL workbench? Example of Average, Sum, Min and Max functions in MySQL How to delete data from MySQL? Update SQL Query Example Order by example in MySQL AND and OR Operators in MySQL Query Where clause with query in MySQL How to use select Statement in MySQL? How to insert data into MySQL Table? Create Database and tables in MySQL example of before insert trigger in mysql Failed to Call Procedure MY Sql Query Error - Not able to Understand the issue which query will be run for previous(button) question How to access data yearly from DB in C# ? Fastest way to upload huge raw data in database - c#, Java or stored procedure DB Insert Nb hours between 2 time stamps meets specific criteria mysql select into table from another table example MySQLselect into new table Example code How to create a .mdf file from script (.sql) Please help me out fixing broken relational links in MySQL database after an upgrade How do I upgrade mysql? mysql 4.x to 5.x upgrade problem Upgrading a PHP/MYSQL application? upgrading sql query join phpmyadmin in whm whm php version update php cpanel cpanel mysql downgrade cpanel mysql version upgrade mysql whm upgrade mysql 4 5 cpanel upgrade mysql cpanel server Did my upgrade from mySQL 5.1 to 5.5 work Upgrade to MySQL 5.5 ? - cPanel Mem use upgrade from MySQL 5.1 to 5.5 - cPanel Upgrading MySQL from 5.0 to 5.1 or 5.5 - cPanel Mysql Upgrade on WHM (Mysql 5.1 to 5.5)cPanel Mysql Upgrade on WHM (Mysql 5.1 to 5.5) - cPanel Updating from MySQL 5.0 to 5.5 cPanel MySQL 5.1 upgrade to 5.5 error Charset problem upon publishing PHP + MySQL website MySQL issue: Table 'data_dictionary.CHARACTER_SETS' doesn't exist SQL Error Version 5.5.15

Ads

 
Advertisement null

Ads