Category: MySQL

mysql table does not exist
April 8th, 2017 by ronny

mysql table does not exist

Mysql table does not exist, but it is there. I can see it when I run show databases. Did you manually move your database instead of export and import? Chances are your are using InnoDB tables in your database. If you did, please continue and we might solve the mysql table does not exist issue.

mysql table does not exist

Take a backup of your existing mysql files. Then try to copy over the files starting with ib. Should be at least one ibdata and ib_logfile. Dump all the data with mysqldump, and you can now go ahead and restore the mysql data. Meaning you can copy your other set of ib files back (the ones you backed up). Import the data dumped with mysqldump. You should now have all your databases back in place.

mysql table does not exist – Clean up

Since you copied your database files, the owner of the files belongs to the user used for the copy. Unless you already did, change the ownership back to mysql.
chown mysql:mysql /dabase_directory -R

Also check the permissions against the other permissions. You probably need to change it back to 660.
chmod -R 660 /database_files

Restart your MySQL service

To make sure everything is catched up with your MySQL server, restart the MySQL server.
service mysql restart

See if that didn’t work.

Happy databasing!

Posted in MySQL Tagged with: ,

April 27th, 2014 by ronny

source-codeA short example on how to use the .net MySql connector with Mono Develop.
First you need to make it available to your project.
Go to Project -> Edit References
Select the .Net Assembly tab. Then Navigate to your folder containing Mysql.Data.dll and select the file, and press ok.

Here is a short example program on how to insert a record into a test MySql database.

[sourcecode language=”csharp”]
using System;
using MySql.Data.MySqlClient;

namespace testmysql
{
class MainClass
{
public static void Main (string[] args)
{
// First a few variables, Assuming MySQL server is at 192.168.1.15 and default port 3306
string cs = @"server=192.168.1.15;port=3306;userid=testuser;password=testpass;database=testdb";
MySqlConnection myCon = null;
MySqlCommand myCmd = null;
//Greating
Console.WriteLine ("Welcome to Test MySQL….");
// create mysql connector, and connect
Console.WriteLine("creating mysql connector…");
myCon = new MySqlConnection(cs);
myCon.Open();
// Create a sql string with sample data, inserted to testtable
string strQuery = "INSERT INTO testdb.testtable(testdata) values (‘Sample Data #1’);";
// Execute
myCmd = new MySqlCommand(strQuery, myCon);
myCmd.ExecuteScalar();
// Close connection
myCon.Close();
Console.WriteLine("Data inserted to MySQL database successfully");
}
}
}
[/sourcecode]

Happy programming!

Posted in Mono Develop, MySQL, Programming

April 25th, 2014 by ronny

MonoDevelopLogoHere is how to install a .net MySql connector for Mono Develop for Linux (Tested for Debian Variants).
First we is going to download the connector, and you will find it here:
http://dev.mysql.com/downloads/connector/net/
Just remember to download the right version 😉

After we downloaded it, put it in a folder i.ex: ~/netConnector/
Rename it to Mysql.Data.dll (It is case sensitive)
It has been an issue for years, but when you download the connector it is all lower case. And if you don’t rename the file, it won’t work.

Next  we is going to do is to install it into to the GAC (Global Assembly Cache). This is needed for the Mono Develop to be able to use it. In general we put our .net dll’s here.
gacutil /i Mysql.Data.dll
You should be able to find the connector here: /usr/lib/mono/gac/

That’s it really. And it is ready to be used in your Mono Develop projects.

Happy programming!

Posted in Debian, Linux, Mono Develop, MySQL, Programming, Ubuntu

March 16th, 2014 by ronny

sql-iconHaven’t needed to reset my MySQL root passwords yet, but I suspect someday….
On a Debian based system this is easy and also demonstrate the importance of restricting physical access to your server.

First run (sudo or root):
dpkg-reconfigure mysql-server-5.5

mysql-password

Then just type your new password and confirm it. The database will restart, and your MySQL now have a new root password.

Happy passwording!

Posted in Debian, MySQL, Ubuntu

February 5th, 2014 by ronny

mysql-database-logo-webHandy to know when installing WordPress, phpBB or any other fancy web applications requiring a database.

First log on to your MySQL server (assuming root user is being used)
mysql -u root -p

When logged on, create the database (called example).
CREATE DATABASE example;

Create a user with password and connection permission. If the web and MySQL server is on the same server, you just let it be localhost. If they are not on the same server, you could use a % instead of localhost. % means it can log on to MySQL from anywhere. That is a security issue. Specify the IP if the MySQL and Web server are on different servers.
CREATE USER ‘username’@’localhost’ IDENTIFIED BY ‘password’;

Now the user is created, and given a password. But still haven’t access to do anything. We will now give it access to use the example database from localhost. Just change the localhost to an ip or address if needed.
GRANT ALL PRIVILEGES ON example.* TO ‘username’@’localhost’;

Then we flush the permissions to activate them.
FLUSH PRIVILEGES;

Your new database and user is now ready. To this in a WordPress, phpBB or any other application require MySQL database here is the details for this example:
Database Address: localhost
Database Name: example
Database Username: username
Database Password: password

Happy databasing!

Posted in MySQL

October 26th, 2013 by ronny

15-Light-Bulb-iconSetup a basic LAMP, enables you to host cool web applications. LAMP is Linux, Apache, MySQL & PHP (guess Perl or Python should qualify as well). I assume you have done at least a minimal Debian installation here.

 

Update & upgrade

First we make sure our packages is updated and upgraded if necessary.
apt-get update && apt-get upgrade

Install Apache2

apt-get install apache2
Type in your ip in the browser to check if it is working. If the browser tell you “It is working” it is working 😉

Install MySQL

apt-get install mysql-server mysql-client
Installation will ask you to set a root password for the MySQL server. If you need root access from remote, check out this article.

Install PHP

apt-get install php5 php5-mysql

Just in case, restart the apache server by /etc/init.d/apache2 restart
Another method of restarting the apache server is: service apache2 restart (this work on Red Hat variants as well)

Your web site root folder will be located at /var/www
So if you create a file called test.php in the web root folder, and paste this: <?php phpinfo(); ?>
Then browser to (IP is just an example) http://192.168.1.20/test.php
You should now see detailed information about your php setup.

There you go, you now have a basic LAMP ready to rock!

Posted in Apache, Debian, Linux, MySQL, PHP

October 26th, 2013 by ronny

mysql_logoA few simple steps to install MySQL with remote root access on a Debian system.  Out of the box, as default, the root user can only log in from localhost. It’s easier to work from your laptop or workstation when your MySQL server is just a console based linux server. Either located on your home network or at a data center.

Login to your server as root, and type:
apt-get install mysql-server

Select your desired root password, and let it finish the installation.
When it’s done, type in:
mysql -u root -p

When you have logged into the MySQL Server, we will need to grant you with remote access rights. Kind of the whole purpose of this anyway.

mysql> GRANT ALL PRIVILEGES ON *.* TO ‘root’@’%’ IDENTIFIED BY ‘your password’ WITH GRANT OPTION;
mysql> FLUSH PRIVILEGES;
mysql> quit

The MySQL server will now accept the root to be logged in from anywhere. But we need to make MySQL to accept connections from outside localhost. This is done by changing the bind in my.cnf. Type in:

vim /etc/mysql/my.cnf       (or you can use any other text editor. To install vim: apt-get install vim)

Locate the line: bind-address = 127.0.0.1
and comment it out by putting a # at the beginning of the line.

For safety I recommend binding it to your ip instead of removing the bind (or actually accept any ip).

Happy developing!

Posted in Debian, Linux, MySQL

Optimization WordPress Plugins & Solutions by W3 EDGE