||Home||Switchboard||Unix Administration||Red Hat||TCP/IP Networks||Neoliberalism||Toxic Managers|
|(slightly skeptical) Educational society promoting "Back to basics" movement against IT overcomplexity and bastardization of classic Unix|
|Securing the Initial MySQL Accou|
|Apache||MS Access to mySql conversion||PHP integration||
|Comparison with other databases||Resetting root password on MySQL||Humor||Etc|
Part of the MySQL installation process is to set up the
mysqldatabase that contains the grant tables:
- On Unix, the grant tables are populated by the mysql_install_db program. Some installation methods run this program for you. Others require that you execute it manually. For details, see Section 2.11.2, “Unix Post-Installation Procedures”.
The grant tables define the initial MySQL user accounts and their access privileges. These accounts are set up as follows:
- Accounts with the user name
rootare created. These are superuser accounts that can do anything. The initial
rootaccount passwords are empty, so anyone can connect to the MySQL server as
root— without a password — and be granted all privileges.
- On Unix, both
rootaccounts are for connections from the local host. Connections must be made from the local host by specifying a host name of
localhostfor one of the accounts, or the actual host name or IP number for the other.
- Two anonymous-user accounts are created, each with an empty user name. The anonymous accounts have no password, so anyone can use them to connect to the MySQL server.
- On Unix, both anonymous accounts are for connections from the local host. Connections must be made from the local host by specifying a host name of
localhostfor one of the accounts, or the actual host name or IP number for the other. These accounts have all privileges for the
testdatabase and for other databases with names that start with
As noted, none of the initial accounts have passwords. This means that your MySQL installation is unprotected until you do something about it:
- If you want to prevent clients from connecting as anonymous users without a password, you should either assign a password to each anonymous account or else remove the accounts.
- You should assign a password to each MySQL
The following instructions describe how to set up passwords for the initial MySQL accounts, first for the anonymous accounts and then for the
rootaccounts. Replace “
newpwd” in the examples with the actual password that you want to use. The instructions also cover how to remove the anonymous accounts, should you prefer not to allow anonymous access at all.
You might want to defer setting the passwords until later, so that you don't need to specify them while you perform additional setup or testing. However, be sure to set them before using your installation for production purposes.
In a Unix environment, the procedure for resetting the
rootpassword is as follows:
- Log on to your system as either the Unix
rootuser or as the same user that the mysqld server runs as.
- Locate the
.pidfile that contains the server's process ID. The exact location and name of this file depend on your distribution, hostname, and configuration. Common locations are
/usr/local/mysql/data/. Generally, the filename has the extension of
.pidand begins with either
mysqldor your system's hostname.
You can stop the MySQL server by sending a normal
kill -9) to the mysqld process, using the pathname of the
.pidfile in the following command:shell>
kill `cat /mysql-data-directory/host_name.pid`
Note the use of backticks rather than forward quotes with the
catcommand; these cause the output of
catto be substituted into the
- Create a text file and place the following command within it on a single line:SET PASSWORD FOR 'root'@'localhost' = PASSWORD('MyNewPassword');
Save the file with any name. For this example the file will be
- Restart the MySQL server with the special
mysqld_safe --init-file=~/mysql-init &
The contents of the init-file are executed at server startup, changing the root password. After the server has started successfully you should delete
- You should be able to connect using the new password.
Alternatively, on any platform, you can set the new password using the mysql client(but this approach is less secure):
- Stop mysqld and restart it with the
--skip-grant-tables --user=rootoptions (Windows users omit the
- Connect to the mysqld server with this command:shell>
mysql -u root
- Issue the following statements in the mysql client:mysql>
UPDATE mysql.user SET Password=PASSWORD('newpwd')->
newpwd” with the actual
rootpassword that you want to use.
- You should be able to connect using the new password.
Many distributions of Linux have an option to install MySQL. In this case, or
even if you compile MySQL, the default password is blank. MySQL can
also run on Windows boxen. When you install
MySQL, make sure that you set the
root password. You can do this:
root@u-1:/home/u-1# mysql -u root mysql Reading table information for completion of table and column names You can turn off this feature to get a quicker startup with -A Welcome to the MySQL monitor. Commands end with ; or g. Your MySQL connection id is 1 to server version: 3.23.47 Type 'help;' or 'h' for help. Type 'c' to clear the buffer. mysql> SET PASSWORD FOR root@localhost=PASSWORD('rubberchicken'); Query OK, 0 rows affected (0.06 sec) mysql>In this example, we set the root password to rubberchicken. Note from the above that the password wasn't set. If we try this again, we need to use the -p option to enter the password:
root@u-1:/home/u-1# mysql -u root mysql ERROR 1045: Access denied for user: 'root@localhost' (Using password: NO) root@u-1:/home/u-1# mysql -u root -p mysql Enter password: Reading table information for completion of table and column names You can turn off this feature to get a quicker startup with -A Welcome to the MySQL monitor. Commands end with ; or g. Your MySQL connection id is 3 to server version: 3.23.47 Type 'help;' or 'h' for help. Type 'c' to clear the buffer. mysql>To reset a root password that you forgot (using paths on our system):
[root@host root]#killall mysqld [root@host root]#/usr/libexec/mysqld -Sg --user=root &
mysqld --skip-grant-tables --user=rootGo back into MySQL with the client:
[root@host root]# mysql Welcome to the MySQL monitor. Commands end with ; or g. Your MySQL connection id is 1 to server version: 3.23.41 Type 'help;' or 'h' for help. Type 'c' to clear the buffer. mysql> USE mysql Reading table information for completion of table and column names You can turn off this feature to get a quicker startup with -A Database changed mysql> UPDATE user -> SET password=password("newpassword") -> WHERE user="root"; Query OK, 2 rows affected (0.04 sec) Rows matched: 2 Changed: 2 Warnings: 0 mysql> flush privileges; Query OK, 0 rows affected (0.01 sec) mysql> exit; [root@host root]#killall mysqld
I installed SuSE Linux 9.1 Professional on an old computer recently. I installed MySQL server (version 4.0.18), Webmin (version 1.250) and Usermin (version 1.180). If I try to connect to the MySQL server with the username root and no password, I get an invalid login error from Webmin, Usermin and mysql-cc. What is the default password, and how can I change it? I am very excited to be learning Linux (after a long journey through Windows-land), but get frustrated on loopholes like these.
Also, an a different note, why would the system stop loading after a certain point (towards the end, don't remeber where) if I have my USB drive plugged in before booting? Dec 29 2005, 02:47 AM
The initial Mysql password is blank according to this info for mysql ver 5.0. YOU WILL HAVE TO READ THE MANUAL FOR YOUR SPECIFIC VERSION. One of the first things they reccomend is to set a new root password and run the Grant table which controls access to the Database.QUOTE
After a fresh installation, you should connect to the server and set up your users and their access permissions:
shell> mysql -u root mysql
The server should let you connect because the MySQL root user has no password initially. That is also a security risk, so setting the password for the root accounts is something you should do while you're setting up your other MySQL users. For instructions on setting the initial passwords, see Section 2.9.3, “Securing the Initial MySQL Accounts”.
The manuals are available at mysql.com either for online reading or by downloading. If you have installed it locally, probably best to download it.
Hope this helps.
OpaQueDec 29 2005, 10:14 AM
Try "su" as username and password is "" (blank).Inspiron
Dec 29 2005, 02:43 PMI'm not sure about MySQL but I guess you can get some references here..
leiaahDec 29 2005, 06:25 PM
The default user is root and the password is, as they say blank for default.
You can set the root password by typing this:
CODE# mysqladmin -u root password 'new-password'
You can then login by typing this:
# mysql -u root –p
Then you'll be prompted to provide the password you specified earlier.
You also might want to delete the anonymous user in the User's table. The default configuration of MySQL allows any user access to the system without
providing a username or password.
Delete the user by typing this:
CODE# mysql -u root –p
mysql> use mysql
mysql> delete from user where User='';
Groupthink : Two Party System as Polyarchy : Corruption of Regulators : Bureaucracies : Understanding Micromanagers and Control Freaks : Toxic Managers : Harvard Mafia : Diplomatic Communication : Surviving a Bad Performance Review : Insufficient Retirement Funds as Immanent Problem of Neoliberal Regime : PseudoScience : Who Rules America : Neoliberalism : The Iron Law of Oligarchy : Libertarian Philosophy
War and Peace : Skeptical Finance : John Kenneth Galbraith :Talleyrand : Oscar Wilde : Otto Von Bismarck : Keynes : George Carlin : Skeptics : Propaganda : SE quotes : Language Design and Programming Quotes : Random IT-related quotes : Somerset Maugham : Marcus Aurelius : Kurt Vonnegut : Eric Hoffer : Winston Churchill : Napoleon Bonaparte : Ambrose Bierce : Bernard Shaw : Mark Twain Quotes
Vol 25, No.12 (December, 2013) Rational Fools vs. Efficient Crooks The efficient markets hypothesis : Political Skeptic Bulletin, 2013 : Unemployment Bulletin, 2010 : Vol 23, No.10 (October, 2011) An observation about corporate security departments : Slightly Skeptical Euromaydan Chronicles, June 2014 : Greenspan legacy bulletin, 2008 : Vol 25, No.10 (October, 2013) Cryptolocker Trojan (Win32/Crilock.A) : Vol 25, No.08 (August, 2013) Cloud providers as intelligence collection hubs : Financial Humor Bulletin, 2010 : Inequality Bulletin, 2009 : Financial Humor Bulletin, 2008 : Copyleft Problems Bulletin, 2004 : Financial Humor Bulletin, 2011 : Energy Bulletin, 2010 : Malware Protection Bulletin, 2010 : Vol 26, No.1 (January, 2013) Object-Oriented Cult : Political Skeptic Bulletin, 2011 : Vol 23, No.11 (November, 2011) Softpanorama classification of sysadmin horror stories : Vol 25, No.05 (May, 2013) Corporate bullshit as a communication method : Vol 25, No.06 (June, 2013) A Note on the Relationship of Brooks Law and Conway Law
Fifty glorious years (1950-2000): the triumph of the US computer engineering : Donald Knuth : TAoCP and its Influence of Computer Science : Richard Stallman : Linus Torvalds : Larry Wall : John K. Ousterhout : CTSS : Multix OS Unix History : Unix shell history : VI editor : History of pipes concept : Solaris : MS DOS : Programming Languages History : PL/1 : Simula 67 : C : History of GCC development : Scripting Languages : Perl history : OS History : Mail : DNS : SSH : CPU Instruction Sets : SPARC systems 1987-2006 : Norton Commander : Norton Utilities : Norton Ghost : Frontpage history : Malware Defense History : GNU Screen : OSS early history
The Peter Principle : Parkinson Law : 1984 : The Mythical Man-Month : How to Solve It by George Polya : The Art of Computer Programming : The Elements of Programming Style : The Unix Hater’s Handbook : The Jargon file : The True Believer : Programming Pearls : The Good Soldier Svejk : The Power Elite
Most popular humor pages:
Manifest of the Softpanorama IT Slacker Society : Ten Commandments of the IT Slackers Society : Computer Humor Collection : BSD Logo Story : The Cuckoo's Egg : IT Slang : C++ Humor : ARE YOU A BBS ADDICT? : The Perl Purity Test : Object oriented programmers of all nations : Financial Humor : Financial Humor Bulletin, 2008 : Financial Humor Bulletin, 2010 : The Most Comprehensive Collection of Editor-related Humor : Programming Language Humor : Goldman Sachs related humor : Greenspan humor : C Humor : Scripting Humor : Real Programmers Humor : Web Humor : GPL-related Humor : OFM Humor : Politically Incorrect Humor : IDS Humor : "Linux Sucks" Humor : Russian Musical Humor : Best Russian Programmer Humor : Microsoft plans to buy Catholic Church : Richard Stallman Related Humor : Admin Humor : Perl-related Humor : Linus Torvalds Related humor : PseudoScience Related Humor : Networking Humor : Shell Humor : Financial Humor Bulletin, 2011 : Financial Humor Bulletin, 2012 : Financial Humor Bulletin, 2013 : Java Humor : Software Engineering Humor : Sun Solaris Related Humor : Education Humor : IBM Humor : Assembler-related Humor : VIM Humor : Computer Viruses Humor : Bright tomorrow is rescheduled to a day after tomorrow : Classic Computer Humor
The Last but not Least Technology is dominated by two types of people: those who understand what they do not manage and those who manage what they do not understand ~Archibald Putt. Ph.D
Copyright © 1996-2021 by Softpanorama Society. www.softpanorama.org was initially created as a service to the (now defunct) UN Sustainable Development Networking Programme (SDNP) without any remuneration. This document is an industrial compilation designed and created exclusively for educational use and is distributed under the Softpanorama Content License. Original materials copyright belong to respective owners. Quotes are made for educational purposes only in compliance with the fair use doctrine.
FAIR USE NOTICE This site contains copyrighted material the use of which has not always been specifically authorized by the copyright owner. We are making such material available to advance understanding of computer science, IT technology, economic, scientific, and social issues. We believe this constitutes a 'fair use' of any such copyrighted material as provided by section 107 of the US Copyright Law according to which such material can be distributed without profit exclusively for research and educational purposes.
This is a Spartan WHYFF (We Help You For Free) site written by people for whom English is not a native language. Grammar and spelling errors should be expected. The site contain some broken links as it develops like a living tree...
|You can use PayPal to to buy a cup of coffee for authors of this site|
Last modified: March 12, 2019