From owner-freebsd-questions@FreeBSD.ORG Sun Jan 10 03:41:43 2010 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3CB85106566C for ; Sun, 10 Jan 2010 03:41:43 +0000 (UTC) (envelope-from freebsd-questions@m.gmane.org) Received: from lo.gmane.org (lo.gmane.org [80.91.229.12]) by mx1.freebsd.org (Postfix) with ESMTP id BE85A8FC13 for ; Sun, 10 Jan 2010 03:41:42 +0000 (UTC) Received: from list by lo.gmane.org with local (Exim 4.50) id 1NTogN-0004X3-FJ for freebsd-questions@freebsd.org; Sun, 10 Jan 2010 04:41:39 +0100 Received: from pool-70-21-26-190.res.east.verizon.net ([70.21.26.190]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sun, 10 Jan 2010 04:41:39 +0100 Received: from nightrecon by pool-70-21-26-190.res.east.verizon.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sun, 10 Jan 2010 04:41:39 +0100 X-Injected-Via-Gmane: http://gmane.org/ To: freebsd-questions@freebsd.org From: Michael Powell Followup-To: gmane.os.freebsd.questions Date: Sat, 09 Jan 2010 22:41:12 -0500 Lines: 68 Message-ID: References: <27095130.post@talk.nabble.com> Mime-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 7Bit X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: pool-70-21-26-190.res.east.verizon.net User-Agent: KNode/4.3.4 Sender: news Subject: Re: Setting root password on mysql 5.4 X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: nightrecon@hotmail.com List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Jan 2010 03:41:43 -0000 jaymax wrote: > > Does anyone know how to set root password on a new mysql installation from > the post? This is the very first thing performed on a brand new fresh install. The canonical procedure (and I haven't had to do it in a while so it is possible it may have changed) looks something like this: As root at a '#' prompt do: mysql --user=root mysql This brings up the mysql prompt: mysql>GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' [press return or enter] at the -> prompt type in the following command: IDENTIFIED BY '' WITH GRANT OPTION; [press return or enter] The above should exit back the mysql> prompt if all went well. This will allow root to login with no password, but only on localhost. If you wish to expand this for the same from any host execute the steps again with the below differences. Otherwise type quit at the mysql> prompt to exit. The main reason the second step may be desirable is to admin from a different box using the MySQLAdminGUI for example. Be warned however!: If this box is accessible by anyone from anywhere it is a security hole as root has NOT yet been assigned a password! And this procedure does NOT assign any password, it only sets the access so you can. mysql>GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' [press return or enter] at the -> prompt type in the following command: IDENTIFIED BY '' WITH GRANT OPTION; [press return or enter] Next at mysql> prompt just type quit to exit. Restart mysql and now root can login with no password. Either use the command line to set the password, or the MySQLAdminGUI in the USERS section. The GUI is simple but I'll leave as an exercise for you to look up the CLI procedure in the MySQL docs should you get this far. You need to follow the above procedure first before you can log in as root in order to change the password. To reiterate: the above does NOT assign a password, it only allows root initial access so he can then set a password. Check out: http://dev.mysql.com/doc/refman/5.1/en/default-privileges.html http://dev.mysql.com/doc/refman/5.1/en/user-account-management.html > Can it be performed after starting the server with > /usr/local/bin/mysqld_safe & > > Or for that matter with > /usr/local/bin/mysql_secure_installation > Sorry but these two are not something I'm really familiar with. If the canonical approach doesn't work, maybe you can try to temporarily start it with neither of these in the mix, set the password, then restart it with these two active again. -Mike