bnevets27 Posted November 19, 2010 Share Posted November 19, 2010 I have had a little trouble setting up mysql and creating a database for xbmc. What I need to finish it off now is to have these two lines run on start up, I think. Edit: I should have clarified that those commands need to be run IN mysql. So I have no idea on how to do that automatically. CREATE USER 'xbmc' IDENTIFIED BY 'xbmc'; GRANT ALL ON *.* TO 'xbmc'; To get the database set up I ran this (mysql-unmenu-package.conf), but running the install script in unmenu gave me this error: error: /usr/bin/mysqladmin: connect to server at 'localhost' failed error: 'Can't connect to local MySQL server through socket '/var/run/mysql/mysql.sock' (2)' Check that mysqld is running and that the socket: '/var/run/mysql/mysql.sock' exists! mysql-unmenu-package.conf I ran, of course edited to my config: #UNMENU_RELEASE $Revision: 7 $ $Date: 2010-03-29 23:12:23 -0400 (Mon, 29 Mar 2010) $ PACKAGE_NAME mysql (SQL-based relational database server) PACKAGE_DESCR MySQL is a fast, multi-threaded, multi-user, and robust SQL PACKAGE_DESCR (Structured Query Language) database server. It comes with a nice API PACKAGE_DESCR which makes it easy to integrate into other applications. PACKAGE_DESCR The home page for MySQL is http://www.mysql.com/ PACKAGE_URL http://slackware.cs.utah.edu/pub/slackware/slackware-12.2/slackware/ap/mysql-5.0.67-i486-1.tgz PACKAGE_FILE mysql-5.0.67-i486-1.tgz PACKAGE_MD5 2152772395c13f5af16874760105a33d PACKAGE_INSTALLED /usr/bin/mysql PACKAGE_DEPENDENCIES none PACKAGE_INSTALLATION installpkg mysql-5.0.67-i486-1.tgz PACKAGE_INSTALLATION [ ! -d /mnt/disk1/mysql ] && mkdir /mnt/disk1/mysql PACKAGE_INSTALLATION chown -R mysql /mnt/disk1/mysql/ PACKAGE_INSTALLATION cp /etc/my-medium.cnf /etc/my.cnf PACKAGE_INSTALLATION sed -i -e "s/#innodb_data_home_dir = \/var\/lib\/mysql\//innodb_data_home_dir = \/mnt\/disk1\/mysql\//" /etc/my.cnf PACKAGE_INSTALLATION sed -i -e "s/#innodb_log_group_home_dir = \/var\/lib\/mysql\//innodb_log_group_home_dir = \/mnt\/disk1\/mysql\//" /etc/my.cnf PACKAGE_INSTALLATION sed -i -e "s/#innodb_log_arch_dir = \/var\/lib\/mysql\//innodb_log_arch_dir = \/mnt\/disk1\/mysql\//" /etc/my.cnf PACKAGE_INSTALLATION [ ! -d /mnt/disk1/mysql/mysql ] && /usr/bin/mysql_install_db --datadir=/mnt/disk1/mysql/ --user=mysql PACKAGE_INSTALLATION cd /usr ; echo "/usr/bin/mysqld_safe --datadir=/mnt/disk1/mysql/ --user=mysql" | at now PACKAGE_INSTALLATION [ ! -e /mnt/disk1/mysql/.unmenu ] && /usr/bin/mysqladmin -u root password 'your_password' PACKAGE_INSTALLATION [ ! -e /mnt/disk1/mysql/.unmenu ] && /usr/bin/mysqladmin -u root -h localhost --password=your_password password 'your_password' PACKAGE_INSTALLATION [ ! -d /mnt/disk1/mysql/Helium ] && /usr/bin/mysqladmin -u root -h localhost --password=your_password create Helium PACKAGE_INSTALLATION [ -d /mnt/disk1/mysql/Helium ] && mysql -u root -h localhost --password=your_password --database=Helium -e "GRANT ALL PRIVILEGES ON Helium.* TO root@'%' IDENTIFIED BY 'your_password' WITH GRANT OPTION;" PACKAGE_INSTALLATION [ -d /mnt/disk1/mysql/test ] && /usr/bin/mysqladmin -u root -h localhost -f --password=your_password drop test PACKAGE_INSTALLATION touch /mnt/disk1/mysql/.unmenu PACKAGE_VERSION_TEST mysql --version 2>&1 | grep Distrib | awk '{print $5}' PACKAGE_VERSION_STRING 5.0.67, PACKAGE_MEMORY_USAGE May be huge This doesn't really bother me because I just needed mysql installed. So I just ran the script above line by line but stopped after: PACKAGE_INSTALLATION cd /usr ; echo "/usr/bin/mysqld_safe --datadir=/mnt/disk1/mysql/ --user=mysql" | at now Then got into mysql and ran: CREATE USER 'xbmc' IDENTIFIED BY 'xbmc'; CREATE database xbmc_video; CREATE database xbmc_music; GRANT ALL ON *.* TO 'xbmc'; I now have the databases working for XBMC. I just don't know how to get them working again on reboot. Also how much of auto install script do I need to run to get mysql installed, as I don't actually need "Helium" Auto install script: SCRIPT_DIRECTORY=/boot/unmenu installpkg mysql-5.0.67-i486-1.tgz [ ! -d /mnt/diskX/_mysql ] && mkdir /mnt/diskX/_mysql chown -R mysql /mnt/diskX/_mysql/ cp /etc/my-medium.cnf /etc/my.cnf sed -i -e "s/#innodb_data_home_dir = \/var\/lib\/mysql\//innodb_data_home_dir = \/mnt\/diskX\/_mysql\//" /etc/my.cnf sed -i -e "s/#innodb_log_group_home_dir = \/var\/lib\/mysql\//innodb_log_group_home_dir = \/mnt\/diskX\/_mysql\//" /etc/my.cnf sed -i -e "s/#innodb_log_arch_dir = \/var\/lib\/mysql\//innodb_log_arch_dir = \/mnt\/diskX\/_mysql\//" /etc/my.cnf [ ! -d /mnt/diskX/_mysql/mysql ] && /usr/bin/mysql_install_db --datadir=/mnt/diskX/_mysql/ --user=mysql cd /usr ; echo "/usr/bin/mysqld_safe --datadir=/mnt/diskX/_mysql/ --user=mysql" | at now [ ! -e /mnt/diskX/_mysql/.unmenu ] && /usr/bin/mysqladmin -u root password 'my_password' [ ! -e /mnt/diskX/_mysql/.unmenu ] && /usr/bin/mysqladmin -u root -h localhost --password=my_password password 'my_password' [ ! -d /mnt/diskX/_mysql/Helium ] && /usr/bin/mysqladmin -u root -h localhost --password=my_password create Helium [ -d /mnt/diskX/_mysql/Helium ] && mysql -u root -h localhost --password=my_password --database=Helium -e "GRANT ALL PRIVILEGES ON Helium.* TO root@'%' IDENTIFIED BY 'my_password' WITH GRANT OPTION;" [ -d /mnt/diskX/_mysql/test ] && /usr/bin/mysqladmin -u root -h localhost -f --password=my_password drop test touch /mnt/diskX/_mysql/.unmenu Thanks Quote Link to comment
Joe L. Posted November 20, 2010 Share Posted November 20, 2010 Upon reboot you would need at a minimum: cd /boot/packages installpkg mysql-5.0.67-i486-1.tgz cp /boot/my.cnf /etc/my.cnf cd /usr ; echo "/usr/bin/mysqld_safe --datadir=/mnt/disk1/mysql/ --user=mysql" | at now touch /mnt/disk1/mysql/.unmenu This assumes the data directory was originally on disk1. It also assumes it is looking in /etc/my.cnf for configuration variables and you had previously saved your desired configuration in a file on the root of the flash drive (/boot/my.cnf) Joe L. Quote Link to comment
Grizz1968 Posted November 29, 2010 Share Posted November 29, 2010 Hi bnevets27 What is the command to do the following? Then got into mysql and ran: Quote Link to comment
Joe L. Posted November 29, 2010 Share Posted November 29, 2010 Hi bnevets27 What is the command to do the following? Then got into mysql and ran: You would type something like this: mysql -u root -p It will prompt for the password you set. Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.