I have problems starting slave server when I add replicate-do-table. Current config that works:
server-id=2
master-host=10.100.27.99
master-user=slejv
master-password=<pass>
master-connect-retry=60
replicate-do-db=piksearch
Config that doesn't work:
server-id=2
master-host=10.100.27.99
master-user=slejv
master-password=<pass>
master-connect-retry=60
replicate-do-db=piksearch
replicate-do-table=artikli
replicate-do-table=artikli_polja
replicate-do-table=artikli_posjete8
replicate-do-table=artikli_view
replicate-do-table=kategorije
replicate-do-table=online
replicate-do-table=pitanje_artikal
replicate-do-table=polja
server02:/etc/mysql# /etc/init.d/mysql restart
Stopping MySQL database server: mysqld.
Starting MySQL database server: mysqld . . . . . . . . . . . . . . failed!
see this link:
replicate-do-db is in contrast to replicate-do-table
you must remove:
replicate-do-db=piksearch
replicate-do-table=artikli
replicate-do-table=artikli_polja
replicate-do-table=artikli_posjete8
replicate-do-table=artikli_view
replicate-do-table=kategorije
replicate-do-table=online
replicate-do-table=pitanje_artikal
replicate-do-table=polja
and write:
replicate-do-table=piksearch.artikli
replicate-do-table=piksearch.artikli_polja
...
Related
I am trying to connect one remote server where I have installed MySQL but it is taking localhost
Remote server where mySQL is installed: 131.116.220.228
Remote server from where db needs to be connected: 131.116.220.220 ('ov046hanpgate01.ddc.teliasonera.net')
use DBI;
print "Testing 1\n";
$DSN="DATABASE=MySQL80;port=3306;host=131.116.220.228";
print "Testing 2\n";
my $dbh = DBI->connect("dbi:mysql:$DSN", "ShrutiTest", "Shruti#92", {PrintError => 0})
or die "Couldn't connect to database: " . DBI->errstr;
print "Testing 3\n";
$dbh->disconnect;
error: Couldn't connect to database: Host 'ov046hanpgate01.ddc.teliasonera.net' is not allowed to connect to this MySQL server at D:\Integrations\OWF\Scripts\test27july.pl line 6.
Looks like you need to allow the user ShrutiTest to connect from the ip where you are running the script, viz. 131.116.220.220
It can be done at the MySQL server by any admin:
GRANT ALL PRIVILEGES ON *.* TO 'ShrutiTest'#'131.116.220.220'
This syntax "DBI:mysql:database=$db;host=$host;port=$port" worked for me in the perl script to connect to a remote MySQL DB from an Unix server.
Solved the same. Code used is:
#!/usr/bin/perl -w
use DBI;
## mysql user database name
$db ="Buffering";
## mysql database user name
$user = "ShrutiBuffer";
## mysql database password
$pass = "Shruti1234";
## user hostname : This should be "localhost" but it can be diffrent too
$host="131.116.220.228";
$port="3306";
## SQL query
$query = "select * from buffering.insert_data";
my $dbh = DBI->connect("DBI:mysql:database=$db;host=$host;port=$port",$user, $pass);
$sqlQuery = $dbh->prepare($query)
or die "Can't prepare $query: $dbh->errstr\n";
$sqlQuery->execute
or die "can't execute the query: $sqlQuery->errstr";
print "values are:: ";
while (#row= $sqlQuery->fetchrow_array()) {
print join(", ", #row), "\n";
}
$sqlQuery->finish;
exit(0);
I'm having a problem to connect my DB cloud sql with php.
I've tried every possible way to connect (pdo, mysqli & mysql)
none of them worked.
I've put an IPv4 for the could sql instance and authorized the compute engine IP in the allowed networks section.
When I'm trying to connect from the compute engine with
mysql --host=cloud_sql_IP --user=my_user --password
it's working and I'm able to see the tables.
On the php side I've put this code:
$db = mysql_connect(<CLOUD_SQL_IPV4>, 'root', '');
if (!$db){
die('Connect Error (' . mysql_error());
}
and I get "Connect Error (Permission denied)"
when I'm trying this way:
$conn = mysql_connect(":/cloudsql/<COMPUTE_INSTANCE>:<DB>", "root", "");
if (!$conn) {
die('Connect Error (' . mysql_error());
}
I'm getting:
"Connect Error (No such file or directory"
What else should I do?
Thanks!
Well after diggin into it for 2 days I managed to connect cloud DB
first run this for the permission fix (centos)
setsebool httpd_can_network_connect=1
And for the php it should be written this way:
new mysqli(
<IP_V4>, // host
'root', // username
'', // password
<DB_NAME>, // database name
null,
'/cloudsql/<GCE_INSTANCE>:<DB>'
);
I downloaded and installed My SQL from http://downloads.mysql.com/archives/mysql-5.0/mysql-5.0.91.tar.gz. The build was successfully and I installed in to a local non-root directory.
However when try to invoke mysql from command line I get the below error -
Linux:>prakash_prasad/bin/mysql-5.0.91/bin 1021> ./mysql
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
Linux:>prakash_prasad/bin/mysql-5.0.91/bin 1022>
Googling around it states modify / create - /etc/my.cnf - but I do not have permissions to create file in /etc. There has to some other fix for the above issue. I greped which MySql files in installation directory has config /tmp/mysql.sock:
Linux:>prakash_prasad/bin/mysql-5.0.91 1018> grep -ir tmp . | grep sock
./include/mysql/mysql_version.h:#define MYSQL_UNIX_ADDR "/tmp/mysql.sock"
./bin/mysqld_safe:safe_mysql_unix_port=${mysql_unix_port:-${MYSQL_UNIX_PORT:-/tmp/mysql.sock}}
./bin/mysql_config:socket='/tmp/mysql.sock'
./bin/mysqld_multi:socket = /tmp/mysql.sock2
./bin/mysqld_multi:socket = /tmp/mysql.sock3
./bin/mysqld_multi:socket = /tmp/mysql.sock4
./bin/mysqld_multi:socket = /tmp/mysql.sock6
./share/mysql/my-small.cnf:socket = /tmp/mysql.sock
./share/mysql/my-small.cnf:socket = /tmp/mysql.sock
./share/mysql/my-medium.cnf:socket = /tmp/mysql.sock
./share/mysql/my-medium.cnf:socket = /tmp/mysql.sock
./share/mysql/my-large.cnf:socket = /tmp/mysql.sock
./share/mysql/my-large.cnf:socket = /tmp/mysql.sock
./share/mysql/my-huge.cnf:socket = /tmp/mysql.sock
./share/mysql/my-huge.cnf:socket = /tmp/mysql.sock
./share/mysql/my-innodb-heavy-4G.cnf:socket = /tmp/mysql.sock
./share/mysql/my-innodb-heavy-4G.cnf:socket = /tmp/mysql.sock
./share/man/man1/mysql-stress-test.pl.1:/tmp/mysql\&.sock\&.
./share/man/man1/mysql-test-run.pl.1:shell> \fB\&.\&./mysql \-S \&./var/tmp/master\&.sock \-h localhost \-u root\fR
./share/man/man1/mysql_config.1: \-\-socket [/tmp/mysql\&.sock]
./share/man/man1/mysqld_multi.1:shell> \fBmysql \-u root \-S /tmp/mysql\&.sock \-p\fR
./share/man/man1/mysqld_multi.1:socket = /tmp/mysql\&.sock2
./share/man/man1/mysqld_multi.1:socket = /tmp/mysql\&.sock3
./share/man/man1/mysqld_multi.1:socket = /tmp/mysql\&.sock4
./share/man/man1/mysqld_multi.1:socket = /tmp/mysql\&.sock6
./share/man/man8/mysqlmanager.8:/tmp/mysqlmanager\&.sock\&. This option has no meaning on Windows\&.
./share/man/man8/mysqlmanager.8:socket=/tmp/manager\&.sock
./share/man/man8/mysqlmanager.8:socket=/tmp/mysql\&.sock
./share/man/man8/mysqlmanager.8:socket = /tmp/mysql\&.sock5
./share/man/man8/mysqlmanager.8:| socket | /tmp/mysql\&.sock3 |
./mysql-test/suite/funcs_1/views/func_view.inc:# ./mysql-test-run.pl --socket=var/tmp/master.sock --start-dirty
./mysql-test/mysql-test-run-shell:LOCAL_SOCKET=/tmp/mysql.sock
./mysql-test/mysql-test-run-shell:MASTER_MYSOCK="$MYSQL_TMP_DIR/master.sock"
./mysql-test/mysql-test-run-shell:SLAVE_MYSOCK="$MYSQL_TMP_DIR/slave.sock"
./mysql-test/mysql-test-run-shell: $MYSQLADMIN --no-defaults -uroot --socket=$MYSQL_TMP_DIR/$ident.sock$3 --connect_timeout=5 --shutdown_timeout=70 shutdown >> $MYSQL_MANAGER_LOG 2>&1
./mysql-test/mysql-test-run-shell: $MYSQLADMIN --no-defaults -uroot --socket=$MYSQL_TMP_DIR/$ident.sock$3 --connect_timeout=1 ping >> $MYSQL_MANAGER_LOG 2>&1
./mysql-test/mysql-test-run-shell: $MYSQLADMIN --no-defaults -uroot --socket=$MYSQL_TMP_DIR/$slave_ident.sock stop-slave > /dev/null 2>&1
./mysql-test/mysql-test-run: # On QNX, /tmp/dir/master.sock and /tmp/dir//master.sock seem to be
./mysql-test/mysql-test-run: my $sockdir = $opt_tmpdir;
./mysql-test/mysql-test-run: $master->[0]->{'path_sock'}= $opt_socket ? $opt_socket : "/tmp/mysql.sock";
./mysql-test/mtr: # On QNX, /tmp/dir/master.sock and /tmp/dir//master.sock seem to be
./mysql-test/mtr: my $sockdir = $opt_tmpdir;
./mysql-test/mtr: $master->[0]->{'path_sock'}= $opt_socket ? $opt_socket : "/tmp/mysql.sock";
./mysql-test/mysql-test-run.pl: # On QNX, /tmp/dir/master.sock and /tmp/dir//master.sock seem to be
./mysql-test/mysql-test-run.pl: my $sockdir = $opt_tmpdir;
./mysql-test/mysql-test-run.pl: $master->[0]->{'path_sock'}= $opt_socket ? $opt_socket : "/tmp/mysql.sock";
./mysql-test/mysql-stress-test.pl:$opt_server_socket= $opt_server_socket ? $opt_server_socket : "/tmp/mysql.sock";
Linux:>prakash_prasad/bin/mysql-5.0.91 1019>
Now I not sure what changes I have to make to be able to use it.
Thanks in advance
Create your my.cnf wherever you want and start the server with
/path/to/mysqld --defaults-file=/path/to/my.cnf
try the --defaults-extra-file=path option if you can't change the /etc/my.cnf file.
Or, if you only want to change the socket, use: --socket=/tmp/mysql.sock
I have my DNS and active directory configured in Server1 (192.163.0.8).
FQDN: abc.domain.com
NetBIOS: abcde
My second Server has Sql Server Installed (both servers are using windows server 2008, but when I try to add Server2(192.163.0.9) to the domain I got the following error message:
an attempt to resolve the dns name of a dc in the domain being joined has failed.
running ipconfig /all in Server2 I got
C:\Users\Administrator>ipconfig /all
Windows IP Configuration
Host Name . . . . . . . . . . . . : Server2
Primary Dns Suffix . . . . . . . :
Node Type . . . . . . . . . . . . : Hybrid
IP Routing Enabled. . . . . . . . : No
WINS Proxy Enabled. . . . . . . . : No
Ethernet adapter Local Area Connection:
Connection-specific DNS Suffix . :
Description . . . . . . . . . . . : Intel(R) PRO/1000 MT Desktop Adapter
Physical Address. . . . . . . . . : 99-99-99-99-99-99
DHCP Enabled. . . . . . . . . . . : No
Autoconfiguration Enabled . . . . : Yes
IPv4 Address. . . . . . . . . . . : 192.163.0.9(Preferred)
Subnet Mask . . . . . . . . . . . : 255.255.255.0
Default Gateway . . . . . . . . . : 192.163.0.1
DNS Servers . . . . . . . . . . . : 192.168.0.8
NetBIOS over Tcpip. . . . . . . . : Enabled
(MORE INFO)
In Server1:
C:\Users\Administrator>ping server1
Pinging SERVER1.abc.domain.com [::1] from ::1 with 32 bytes of data:
Reply from ::1: time<1ms
.....
C:\Users\Administrator>ping abc.domain.com
Pinging abc.domain.com [192.163.0.8] with 32 bytes of data:
Reply from 192.163.0.8: bytes=32 time<1ms TTL=128
....
C:\Users\Administrator>ping server1.abc.domain.com
Pinging SERVER1.abc.domain.com [::1] from ::1 with 32 bytes of data:
Reply from ::1: time<1ms
...
C:\Users\Administrator>ping server2
Pinging SERVER2 [192.163.0.9] with 32 bytes of data:
Reply from 192.163.0.9: bytes=32 time<1ms TTL=128
.....
In Server2
C:\Users\Administrator>ping server2
Pinging SERVER2 [::1] from ::1 with 32 bytes of data:
Reply from ::1: time<1ms
.....
C:\Users\Administrator>ping server1
Pinging SERVER1 [192.163.0.8] with 32 bytes of data:
Reply from 192.163.0.8: bytes=32 time<1ms TTL=128
.....
C:\Users\Administrator>ping abc.domain.com
Ping request could not find host abc.domain.com. Please check the name an
d try again.
C:\Users\Administrator>ping server1.abc.domain.com
Ping request could not find host server1.abc.domain.com. Please check the
name and try again.
Help please! :(
http://social.technet.microsoft.com/Forums/en-US/winservergen/thread/12d31d89-4e4a-4451-bf10-cca38d32e84f
Open Registry Editor (regedit).
2. Navigate to the following registry key:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\tcpip6\Parameters\
Create the following registry value (DWORD type): DisabledComponents
Set value to 0
Restart your server.
Diwakar
I'm getting the following error on my site when I upload it or submit a page:
mysql_real_escape_string() [function.mysql-real-escape-string]: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
What in the world does this mean?
Since the error is being thrown by the call to mysql_real_escape_string() it rather implies that you didn't call mysql_connect() first and pass a valid db handle to mysql_real_escape_string (or the call to mysql_connect() failed).
In some circumstances, the mysql extension will attempt to connect automatically using the default settings in php.ini, failing over to my.cnf if these are not available - which obviously are not valid. Or it may be that the settings are valid but the mysqld is not running.
Have you got scripts which are connecting to the database successfully?
Do you have a username and password for the database?
Try:
check_running();
$user=''; // fill in your details
$password=''; // fill in your details
$hosts=array(
'localhost', '127.0.0.1', $_SERVER['HTTP_HOST'], $_SERVER['SERVER_ADDR']
);
foreach ($hosts as $addr) {
try_con($addr, $user, $password);
try_con($addr . ':3306', $user, $password);
}
function try_con($host, $user, $password)
{
$dbh=mysql_connect($host, $user, $password);
if ($dbh) {
print "Connected OK with $host, $user, $password<br />\n";
} else {
print "Failed with $host, $user, $password<br />\n";
}
}
function check_running()
{
// this assumes that you are using Apache on a Unix/Linux box
$chk=`ps -ef | grep httpd | grep -v grep`;
if ($chk) {
print "Checking for mysqld process: " . `ps -ef | grep mysqld | grep -v grep` . "<br />\n";
} else {
print "Cannot check mysqld process<br />\n";
}
}
Yes exactly, some servers pass the default connection parameters when using mysql functions before connection and throw off an error, some other servers work just fine wherever you place the code
it is always safer to just place mysql_real_escape_string() after establishing mysql_connect() connection