Not logged in
Talk
Contributions
Create account
Log in
Navigation
Main page
Recent changes
Random page
Help about MediaWiki
Page
Discussion
Edit
View history
Editing
Mika/Notes/Computer Stuff
(section)
From WikiDotMako
Jump to:
navigation
,
search
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
==Cheat Sheet== * command line to restart mysql: /etc/init.d/mysql start * check ps fax for mysqld to see if the mysql server is running. * mysql_connect() * mysql_select_db() * mysql_query() * mysql_num_rows() * [http://php.net/manual/en/function.mysql-free-result.php mysql_free_result()] * mysql_close() * This is for outputting mysql queries into a text file: mysql > select * from table INTO OUTFILE '/tmp/test.txt'; '''Problem:''' I tried to write a php and connect to mysql in it but I got an error: Fatal Error: undefined function mysql_connect() '''Solution:''' [http://www.webmasterworld.com/forum88/5216.htm This page] suggested that mysql isn't enabled by dafault in php5. I installed php5-mysql and restarted apache2 (don't know if that was necessary) and now it works. ---- '''Problem:''' I restarted my computer because I couldn't start gimp unless I was root. Clint told me that I should sudo /etc/init.d/dbus restart , which basically restarted my whole computer. Since then, I couldn't use mysql because I kept getting this error: ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) '''Solution:''' I followed [http://forums.mysql.com/read.php?11,42525,46765#msg-46765 this] and restarted mysql by: /etc/init.d/mysql restart But it fails. It seems like I touched my.cnf and didn't restart mysql, so when my computer restarted, it incorporated the changes I made in my.cnf and mysql stopped working. I reinstalled mysql-server through apt-get, restarted mysql and now it's fine. ---- '''Problem:''' I have a bunch of text files from USDA, which contain bits and pieces USDA ASCII databases. I want to put them into mysql. '''Solution:''' 1. I found schema.sql that Erik created, so I'm going to borrow it rather than creating my own. mysql databasename < schema.sql -p '''Problem:''' mysql> create database newdatabase; ERROR 1044 (42000): Access denied for user 'user'@'localhost'... '''Solution:''' [http://dev.mysql.com/doc/refman/5.1/en/creating-database.html mysql] 1. Check grants for 'user'@'localhost' in mysql: mysql> show grants for 'user'@'localhost'; 2. Log into mysql as root (has all privileges) and change grants for a specific user: mysql> grant all privileges on *.* to 'user'@'localhost'; Query OK, 0 rows affected (0.00 sec) 3. Log back into mysql as user (now has all privileges) and try creating a new database again. ----
Summary:
Please note that all contributions to WikiDotMako are considered to be released under the Attribution-Share Alike 3.0 Unported (see
WikiDotMako:Copyrights
for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource.
Do not submit copyrighted work without permission!
To protect the wiki against automated edit spam, we kindly ask you to solve the following CAPTCHA:
Cancel
Editing help
(opens in new window)
Tools
What links here
Related changes
Special pages
Page information