Tag Info

New answers tagged

1

Because of the other answers did not answer your question completely here are the right answer: To fire up an sql script via command line you have to execute: mysql -u [USERNAME] -p < /path/to/sqlscript [USERNAME] must be the database administrator or another user with sufficient rights to create a database. The password will be asked after execution. ...


2

You can use the mysqladmin command. The following command will create a database named 'abcd' from shell. mysqladmin -u root -p<yourpasswd> create abcd Please note that there is no space between -p and the password. If you wish to run the command without the password in the command line, you can do it without it, but then it will ask for the ...


2

You can use the following syntax to achieve this from e.g. a bash-script: mysql -u [user] -p[pass] << EOF [mysql commands] EOF


1

val0x00ff's answer was correct in the comment section above RESULT=$(mysql -u user -p "${PASS}" -h RemoteHostName DBName -e "select count(*) from TableName;")


0

You need to escape the password value, not its usage: PASS="pass\$word"; RESULT=`mysql -u user -p'${PASS}' -h RemoteHostName DBName -e "select count(*) from TableName;"`; echo "${RESULT}"; As everything after the $ is being interpreted as a reference to a variable named $word [user@host ~]$ echo "pass$word" pass [user@host ~]$ echo "pass\$word" pass$word ...


1

I would like to notice that it could also be a problem with mysql binary logs rather than with database files themself. Binlogs are placed in /var/log/mysql directory by default in many cases and they tend to consume few times more disk space than database files. It's because binlogs store all of the SQL data modifying queries (UPDATEs, INSERTs, etc.) to ...


4

MySQL data is stored in /var/lib. There is no more space in /var. MySQL does not start. Pretty simple actually. Have a look at /var/log and clean it up. I would recommend something like (delete all gz files in /var/log) : $ find /var/log -iname "*.gz" -delete Of course, you might wanna check what's being deleted first: $ find /var/log -iname "*.gz" ...


3

This is a useful command to find the largest files: du -ak /var | sort -nr | less Usage: du -ak summarizes the disk usage of all (-a) files in the /var partition and prints the size in kilobytes (-k). sort -nr Concatenates the list of files and sorts them into a reversed (-r) numerical (-n) order. less Will paginate the output so that you can see the ...


5

Why are you so sure you don't need it? Perhaps other packages depend on it, it is not used exclusively to set up a mysql server, some programs manage their internal DBs using it for example. Now, to answer your question, the first step is indeed to find out what package installed those files: $ dpkg -S /usr/bin/mysql mysql-client-core-5.5: /usr/bin/mysql ...


3

If you want to use apt-get remove for a file contained in a specific package you can do: apt-get remove $(dpkg -S /usr/bin/mysql | cut -d ':' -f 1) (replace /usr/bin/mysql, with whatever file you were looking for to remove) Using this, apt-get will still ask if you really want to remove the package (that dpkg found), sometimes you realise you did not ...


1

I realized the solution was much simpler than I expected, simply create an SSH tunnel like so: ssh -f -p port username@ip -L 3306:ip:3306 -N Where port is the port of the web server, and ip is the IP address of it. I'm working on using AutoSSH to keep a persistent connection.


0

the tables plugin_flowview_schedules and host were corrupt and mysqlcheck was not detecting this. found while converting each table one by one to InnoDB and got the 1033 error. I did a mysql export of just the tables and then imported the .sql into the CentOS 6 machine and the error went away and the graphs popped right up. Note that I rsync'ed the ...


1

The issue was indeed related to apparmor. For some reason, these two lines were commented out in the new /etc/apparmor.d/usr.sbin.mysql file: # /var/lib/mysql/ r, # /var/lib/mysql/** rwk, Uncommenting them fixed the issue. Thanks to @Belrog and @slm who pointed me in the right direction.


0

Looks like you need to GRANT access to the database GRANT priva on database.* to user@ip for example GRANT SELECT, INSERT, UPDATE, DELETE on mydb.* to fred@10.10.5.5 You can also add IDENTIFIED BY 'password' if you want to also add a password for the user in the same step. Obviously this is performed on the database on "1st ip address" giving "2dn ip ...


1

Courtesy @hbdgaf, this how-to put me on the right track: export DEBIAN_FRONTEND=noninteractive echo mysql-apt-config mysql-apt-config/enable-repo select mysql-5.7-dmr | sudo debconf-set-selections wget http://dev.mysql.com/get/mysql-apt-config_0.2.1-1ubuntu12.04_all.deb sudo dpkg --install mysql-apt-config_0.2.1-1ubuntu12.04_all.deb I put together this ...


0

Edit /etc/security/limits.conf and add the following lines mysql soft nofile 65535 mysql hard nofile 65535 then reboot. Then edit /usr/lib/systemd/system/mysqld.service or /usr/lib/systemd/system/mariadb.service and add LimitNOFILE=infinity LimitMEMLOCK=infinity Then restart the db service: systemctl reload mariadb.service


1

Currently the best option is to use official MySQL APT repo which allows apt-get upgrade installation.


3

Errno 13 means "permission denied", either the files themselves aren't readable and/or the directories leading to the files aren't accessible (/, /var, /var/lib need execute permissions for the mysql user, /var/lib/mysql and below needs read/write/execute). In this case it looks like it's limited to the mysql/performance_schema directory under ...


1

Some of the utilities installed as part of the package are perl scripts: $ head -n 1 /usr/bin/mysql_fix_extensions #! /usr/bin/perl $ head -n 1 /usr/bin/mysql_convert_table_format #! /usr/bin/perl and so on...



Top 50 recent answers are included