My blog on Linux and programming. Covers Linux, VoIP, C, mysql, php and everything else that I come across while tinkering with my Linux boxes.
Showing posts with label mysql. Show all posts
Showing posts with label mysql. Show all posts
Sunday, August 23, 2009
mysql-embedded
Well, I was looking at sqlite last week. But while doing a yum update I found this rpm package. "mysql-embedded". On doing a rpm -qi, it told me that this is a C interface to mysql that can directly be embedded in your application. I haven't tried it yet. But I am sure its going to be interesting. The package has only one shared library. However the size is ~7.5M. If I happen to use it, will post again here.
Saturday, June 13, 2009
Migrating phpBB2.0.13 on RH9 to phpBB3 on F11
I am doing this for my division in SISO. I am typing in stuff as I do it.
1. Tar the old BB directory
tar cvjf bb.tbz phpBB2
(Replace phpBB2 with the name of the folder containing your earlier phpBB2 installation)
2. Get the data from the mysql table
mysqldump -u root -p --databases div_dbase > div.sql
(replace 'root' with any other admin name who has full permission and 'div_dbase' with the name of database used by your old installation)
3. Scp these files to your new machine.
(It is expected that you have mysql, php-mysql, apache etc are installed and turned on in the new machine)
4. re-insert the sql data
mysql -u root -p < div.sql
Note 1: If you are a mysql pro and want to take some trouble configuring a new user at your old machine who can access mysql db on the old machine from the new one, this step might not be needed
Note 2: The mysql that comes with F11 does not consider --- as a comment. However the old sql dump will have a line like -------------. Just edit it and make it -- --------------- (Note the space after two hyphens).
5. Untar the old BB2 installation folder into /var/www/html. Rename if necessary (You may want to use the same folder name for BB3)
6. Download and install BB3
7. Make the directories of BB3 owned by apache user
chown -R apache.apache forum
(Where 'forum' is the folder containing the BB3 installation)
8. Click on the convert tab. Enter necessary information. Assuming you followed step 4, you will have to enter: new root password, location of old BB2 wrt to new BB3 (If you were strictly sticking to these instructions, it will be ../) and the table prefix for the old db (phpbb_ is the default)
Thats it. Just click the convert button and you will have the new BB ready in a few minutes!
1. Tar the old BB directory
tar cvjf bb.tbz phpBB2
(Replace phpBB2 with the name of the folder containing your earlier phpBB2 installation)
2. Get the data from the mysql table
mysqldump -u root -p --databases div_dbase > div.sql
(replace 'root' with any other admin name who has full permission and 'div_dbase' with the name of database used by your old installation)
3. Scp these files to your new machine.
(It is expected that you have mysql, php-mysql, apache etc are installed and turned on in the new machine)
4. re-insert the sql data
mysql -u root -p < div.sql
Note 1: If you are a mysql pro and want to take some trouble configuring a new user at your old machine who can access mysql db on the old machine from the new one, this step might not be needed
Note 2: The mysql that comes with F11 does not consider --- as a comment. However the old sql dump will have a line like -------------. Just edit it and make it -- --------------- (Note the space after two hyphens).
5. Untar the old BB2 installation folder into /var/www/html. Rename if necessary (You may want to use the same folder name for BB3)
6. Download and install BB3
7. Make the directories of BB3 owned by apache user
chown -R apache.apache forum
(Where 'forum' is the folder containing the BB3 installation)
8. Click on the convert tab. Enter necessary information. Assuming you followed step 4, you will have to enter: new root password, location of old BB2 wrt to new BB3 (If you were strictly sticking to these instructions, it will be ../
Thats it. Just click the convert button and you will have the new BB ready in a few minutes!
Friday, April 24, 2009
mysql commands (2)
This is perhaps the most useful command in mysql that I have come across till now.
describe table_name;This command will describe the contents of the table. Then it is very easy to insert the contents into the table.
insert into table_name ( var1,var2,var3) values (val1,val2,val3);Next post after my current experiment :)
Wednesday, March 4, 2009
mysql commands (1)
Following are some useful mysql commands that I learned today
1. Reset mysql root password
1.1 Stop mysql service
2. Add a database (Login to mysql as root for all the below operations)
The command below will add a user. But there is a catch here. The 'password' should be the hash value of the password. To get the hash of a password, use
select PASSWORD('MyPlainTextPassword');
It will output a value like "1b25e4042f3f780d". Use this in the next command.
1. Reset mysql root password
1.1 Stop mysql service
service mysqld stop1.2 Start mysql in safe mode by skipping grant table
mysqld_safe --skip-grant-table1.3 Enter as root user
mysql -u root1.4 Change the root password
UPDATE mysql.user SET Password=PASSWORD('new_password') WHERE User='root';1.5 Flush mysql privileges
flush privileges;1.6 Kill mysqld_safe and mysqld
2. Add a database (Login to mysql as root for all the below operations)
create database3. Add a new user;
The command below will add a user. But there is a catch here. The 'password' should be the hash value of the password. To get the hash of a password, use
select PASSWORD('MyPlainTextPassword');
It will output a value like "1b25e4042f3f780d". Use this in the next command.
grant all privileges on db_name.* to 'user'@'localhost' identified by password '1b25e4042f3f780d';4. Drop a user
use mysql;
drop user;
Subscribe to:
Posts (Atom)