[mythtv-users] mysql error

Teruel de Campo MD chusty at attglobal.net
Mon Jan 8 03:25:42 UTC 2007


> Anyone have an idea as to how to set the MySQL password(s) properly.  I
> am not a database person and am not confident I'd just spin wheels
> reading/searching the MySQL sites.  For instance, I followed the Myth
> doc recommendations on securing the password and played with settings
> provided in the mc.sql file - to no avail.

Rick,

First a very basic question: what is your user name? Or what is your
promppt. If your prompt is not
mythtv at site:~> for example that may be the problem. 

I will paste  a small guide  I created for myself when I started to use
mysql and mythtv. Looks at (5)

***General Terminology:

MySQL is a RDBMS and  it is composed of server program (mysqld) and one
or more client programs (mysql etc). So MySQL is the whole package,
mysql is just an interactive client. 

An important point:
- database names must be different across the system
- table can have the same cames across the system

Requirements:

- MySQL installed (server/client). The client needs to be in the machine
were you work; the server could be in any place.
- MySQL account in the server
- A database to work with

If it is the first time using MySQL after installation you may have to
initialized  data directory, the mysql database and the default grant
tables. There is an installation script that you may have t run. With
rpm installation this script is run automatically. Just in case:

Go to the /usr/bin

su
mysql_install_db --user=mysql

     To initialize the grant tables

***1. Start the server:

1.1 Two ways to start the server:

#/etc/init.d/mysql start

or 

Yast sytem/Runlevel/mysql enable

This will start the service and at the begining will initialized the
grant tables, creating a mysql and test databases. It runs the script
mysql_install_db

***1.2 How to Stop the Server

linux:/home/tdec # /etc/init.d/mysql stop

1.2 Hot to restart the Server

# /etc/init.d/mysql restart


***2.REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:
/usr/bin/mysqladmin -u root password 'new-password'
or
/usr/bin/mysqladmin -u root -h amd.site password 'new-password'

# cd /usr/bin/
# mysqladmin -u root password 'bouv1'
or
# /usr/bin/mysqladmin -u root -h amd.site password bouv1

***3. Test the new password for root:

# mysql -u root -p mysql
mysql>SELECT host, user, password FROM user;
+------------+------+-------------------------------------------+
| host       | user | password                                  |
+------------+------+-------------------------------------------+
| localhost  | root | *B38ADCFE256D2ECA9AED7A3183A0781EA5B9DAEB |
| amd.site | root |                                           |
|amd.site |      |                                           |
| localhost  |      |                                           |
+------------+------+-------------------------------------------+
4 rows in set (0.01 sec)
Do not delete ever these host/users!!

***4. If there are other users from previous installation they can be
removed.

$mysql -u root -p mysql
mysql>DESCRIBE user;  describe the structure of the table
mysql>SELECT * FROM user;  will show all data in the user table
mysql>SELECT host, user, password FROM user;  will show the user and
passord of each account

To modify existing record use UPDATE
UPDATE tbl_name
SET which columns to change
WHERE which records to update

With UPDATE as well as for DELETE is not a bad idea to test a WHERE with
the SELECT statement.
mysql> 
+--------+
| user   |
+--------+
| mythtv |
+--------+
1 row in set (0.00 sec)

mysql> DELETE user FROM user WHERE user='mythtv';
will remove user='mythtv'

***5. Create the mythtv database.

$ cd ~/mtv/mythtv/database/

open  mc.sql with an editor. To leave this file unchanged you MUST
create a separate user called mythtv with a password mythtv. If on the
other hand you want to use the regular user like "tdec" (this is my home
user name) open the file mc.sql and just change the mythtv at localhost to
tdec at localhost. DO NOT change IDENTIFY 'mythtv" because this is the
password

$ pico mc.sql
$ mysql -u root -p < mc.sql

Of course be sure you are in the directory where mc.sql is or add the
path to the line.

it will : (1) create a database named mythconverg (2) will create an
entry into mysql.user table with tdec a user and mythtv as password.

If you have run <mysql -u root -p < mc.sql>  without changing the name
in mc.sql and you are planning to run it from a linux user that is not
mythtv then check the data base:

$mysql -u root -p mysql 

mysql> SELECT host, user, password FROM user;

will show the user and passord of each account

then if there is a user call mythtv and you plan to run it from a
different user just change it

mysql> UPDATE user
    -> SET user='tdec'
    -> WHERE user='mythtv'
    -> ;
mysql> SELECT host, user, password FROM user;
will confirm the change.

mysql>exit

***6. Check that mythdatabase has been created the correct user entered.

$mysql -u root -p mysql

mysql>SHOW DATABASES;

shows the database mythconverg

mysql>SELECT host, user, password FROM user;

shows the new user (tdec) and password endoded

***7. mysqladmin howto.

be sure to include user and password is need it.

$ mysqladmin -u root -p status


Now I love mysql but at the begining is was hard, so I understand your
feeling.

Hope it help you.

-=terry(Denver)=-



More information about the mythtv-users mailing list